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

Make sure to handle the case when search results come back in a different order than retrieved #15479

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
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ export class VisualizeListingTable extends Component {
this.debouncedFetch = _.debounce(filter => {
this.props.fetchItems(filter)
.then(items => {
this.setState({
isFetchingItems: false,
selectedRowIds: [],
filter,
});
this.items = items;
this.calculateItemsOnPage();
// We need this check to handle the case where search results come back in a different
// order than they were sent out. Only load results for the most recent search.
if (filter === this.state.filter) {
this.setState({
isFetchingItems: false,
selectedRowIds: [],
});
this.items = items;
this.calculateItemsOnPage();
}
});
}, 200);
}, 300);
}

componentWillUnmount() {
Expand Down