Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error caused by cloning react table internal state instance #2249

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/TaskAnalysisTable/TaskAnalysisTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import _reverse from 'lodash/reverse'
import _keys from 'lodash/keys'
import _concat from 'lodash/concat'
import _filter from 'lodash/filter'
import _cloneDeep from 'lodash/cloneDeep'
import _split from 'lodash/split'
import _isEmpty from 'lodash/isEmpty'
import _merge from 'lodash/merge'
import _pick from 'lodash/pick'
import parse from 'date-fns/parse'
import differenceInSeconds from 'date-fns/difference_in_seconds'
import { messagesByStatus,
Expand Down Expand Up @@ -104,7 +104,9 @@ export class TaskAnalysisTableInternal extends Component {
boundingBox: this.props.boundingBox,
includeTags: !!_get(this.props.addedColumns, 'tags')})

this.setState({lastTableState: _cloneDeep(tableState)})
// Use pick instead of cloneDeep, as cloning the entire tableState seems to cause an error
// when any column with a "makeInvertable" header is present.
this.setState({lastTableState: _pick(tableState, ["sorted", "filtered", "page"])})
}

configureColumns() {
Expand Down
Loading