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

[ML] DF Analytics job list: ensure filter works as expected #62041

Merged
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 @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: You could name this const updatedPageStart = ..., this would allow the upper let pageStart to become const pageStart.

setPageIndex(pageStart / pageSize);
}

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