Skip to content

Commit

Permalink
ensure pageIndex is set correclty in analytics list (#62041)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Apr 1, 2020
1 parent 710615b commit 4ecddeb
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ export const DataFrameAnalyticsList: FC<Props> = ({
.filter(m => (m && m.count) >= clauses.length)
.map(m => m.analytics);

let pageStart = pageIndex * pageSize;
if (pageStart >= filtered.length && filtered.length !== 0) {
// if the page start is larger than the number of items due to
// filters being applied, calculate a new page start
pageStart = Math.floor((filtered.length - 1) / pageSize) * pageSize;
setPageIndex(pageStart / pageSize);
}

setFilteredAnalytics(filtered);
setIsLoading(false);
};
Expand Down

0 comments on commit 4ecddeb

Please sign in to comment.