-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Fix grouping rows per page bug #157807
Conversation
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
To update your PR or re-run it, just comment with: |
@@ -149,6 +149,12 @@ const GroupedAlertsTableComponent: React.FC<AlertsTableComponentProps> = (props) | |||
setStoragePageSize(newArr); | |||
return newArr; | |||
}); | |||
// set page index to 0 when page size is changed | |||
setPageIndex((currentIndex) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the bug fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
(cherry picked from commit 8181597)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…157884) # Backport This will backport the following commits from `main` to `8.8`: - [[Security Solution] Fix grouping rows per page bug (#157807)](#157807) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2023-05-16T14:15:23Z","message":"[Security Solution] Fix grouping rows per page bug (#157807)","sha":"8181597cc9f422b38341761b308db6b3176614bf","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat Hunting","Team: SecuritySolution","Team:Threat Hunting:Explore","v8.8.0","v8.9.0"],"number":157807,"url":"https://github.com/elastic/kibana/pull/157807","mergeCommit":{"message":"[Security Solution] Fix grouping rows per page bug (#157807)","sha":"8181597cc9f422b38341761b308db6b3176614bf"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/157807","number":157807,"mergeCommit":{"message":"[Security Solution] Fix grouping rows per page bug (#157807)","sha":"8181597cc9f422b38341761b308db6b3176614bf"}}]}] BACKPORT--> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Summary
Fixes #156515
We were not reseting the active page to 0 when rows per page changed. If we had 100 groups with rows per page set to 10, and navigate to page 10. Then set rows per page to 100. Because we are still on page 10, it is querying for results 900-1000 which do not exist. It shows an empty page. We need to reset to page 1 to make sure data still exists for the page we are loading.