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

[Security Solution] Fix grouping rows per page bug #157807

Merged
merged 1 commit into from
May 16, 2023

Conversation

stephmilovic
Copy link
Contributor

@stephmilovic stephmilovic commented May 15, 2023

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.

@stephmilovic stephmilovic added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore v8.8.0 v8.9.0 labels May 15, 2023
@stephmilovic stephmilovic requested review from a team as code owners May 15, 2023 22:21
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 9.2MB 9.2MB +73.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 400 404 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 480 484 +4
total +6

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@@ -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) => {
Copy link
Contributor Author

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

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM!

@stephmilovic stephmilovic merged commit 8181597 into elastic:main May 16, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 16, 2023
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.8

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 16, 2023
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.8.0 v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security Solution]Row Per Paging breaking on changing page number and per page
5 participants