Skip to content

Commit

Permalink
[ML] Fix pagination reset on search query update. (#65668)
Browse files Browse the repository at this point in the history
Fixes pagination issue: When the query bar query changes, we need to check the selected page is still valid. Example: If you're on a last page (125), edit the filter, and it looks like the grid is trying to reload page 125 even though there are only 24 pages for the new query value you end up with an empty table.
This brings over a fix already in place for the transform data grids: On every search query change we'll reset the pagination index.
  • Loading branch information
walterra committed May 8, 2020
1 parent 88d9f17 commit 673df49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export const useExplorationResults = (
d => !d.includes(`.${FEATURE_IMPORTANCE}.`) && d !== ML__ID_COPY
);

useEffect(() => {
dataGrid.resetPagination();
}, [JSON.stringify(searchQuery)]);

useEffect(() => {
getIndexData(jobConfig, dataGrid, searchQuery);
// custom comparison
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export const useOutlierData = (
d => !d.includes(`.${FEATURE_INFLUENCE}.`) && d !== ML__ID_COPY
);

useEffect(() => {
dataGrid.resetPagination();
}, [JSON.stringify(searchQuery)]);

// initialize sorting: reverse sort on outlier score column
useEffect(() => {
if (jobConfig !== undefined) {
Expand Down

0 comments on commit 673df49

Please sign in to comment.