Skip to content
Closed
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@ export class AnomaliesTableInternal extends Component {
};

onTableChange = ({ page, sort }) => {
const pageCopy = { ...page };
const { tableState, updateTableState } = this.props;
const result = {
pageIndex: page && page.index !== undefined ? page.index : tableState.pageIndex,
pageSize: page && page.size !== undefined ? page.size : tableState.pageSize,
sortField: sort && sort.field !== undefined ? sort.field : tableState.sortField,
pageIndex: page && page.index !== undefined ? pageCopy.index : tableState.pageIndex,
pageSize: page && page.size !== undefined ? pageCopy.size : tableState.pageSize,
sortField: sort && sort.field !== undefined ? pageCopy.field : tableState.sortField,

@darnautov darnautov Apr 26, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual problem is with sortField and changes in your PR replace it with pageCopy.field which is always undefined because the updates come from the sort property. Check #98270 for more details.

Also important to note, in JavaScript, numbers and strings are not a reference type, hence creatingpageCopy doesn't affect anything, because we access index and size by value at all times.

sortDirection:
sort && sort.direction !== undefined ? sort.direction : tableState.sortDirection,
};
Expand Down