-
Notifications
You must be signed in to change notification settings - Fork 8k
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
[Cloud Security] Disable/Enable rule takes too long #182768
[Cloud Security] Disable/Enable rule takes too long #182768
Conversation
x-pack/plugins/cloud_security_posture/public/pages/rules/use_change_csp_rule_state.ts
Show resolved
Hide resolved
/ci |
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security) |
/ci |
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.
overall LGTM, just some comments,
Great test coverage 🚀
x-pack/plugins/cloud_security_posture/public/pages/rules/use_change_csp_rule_state.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/cloud_security_posture/public/pages/rules/use_change_csp_rule_state.ts
Show resolved
Hide resolved
x-pack/plugins/cloud_security_posture/public/pages/rules/rules_table_header.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cloud_security_posture/public/pages/rules/rules_flyout.tsx
Outdated
Show resolved
Hide resolved
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
x-pack/plugins/cloud_security_posture/public/pages/rules/change_csp_rule_state.ts
Show resolved
Hide resolved
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.
Looks great, Sean 👑
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
This change resolves the Benchmark Rules page's performance when enabling or disabling rules. Most of the work was converting the
change_csp_rule_state
to use the ReactQueryuseMutation
hook. This change introduces optimistic updating of the cached data, while at the same time performing the HTTP request to bulk update to mute or unmute the rules.Should anything fail with the HTP request, the snapshot of the data taken before the cache was optimistically updated will replace the mutated data.
Other changes:
refetch
call in the rules_table and instead opted to use theinvalidateQueries
await
from the originalinvalidateQueries
as these can be executed in the background.useMemo
hook from the table columns because there was no visual difference and it introduces more complexity for the execution.Screen.Recording.2024-05-09.at.11.41.33.AM.mov
Checklisthttps://github.com//pull/182768/files
For maintainers