[kbn-expandable-flyout] - refactor push/overlay to use redux instead of hooks#192745
Conversation
|
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
4ded46f to
d5df007
Compare
packages/kbn-expandable-flyout/src/components/preview_section.test.tsx
Outdated
Show resolved
Hide resolved
packages/kbn-expandable-flyout/src/hooks/use_initialize_from_local_storage.test.ts
Outdated
Show resolved
Hide resolved
packages/kbn-expandable-flyout/src/components/settings_menu.tsx
Outdated
Show resolved
Hide resolved
d5df007 to
d839661
Compare
packages/kbn-expandable-flyout/src/hooks/use_initialize_from_local_storage.ts
Outdated
Show resolved
Hide resolved
packages/kbn-expandable-flyout/src/hooks/use_initialize_from_local_storage.ts
Outdated
Show resolved
Hide resolved
d839661 to
8e091aa
Compare
8e091aa to
f21d1c1
Compare
christineweng
left a comment
There was a problem hiding this comment.
Overall LGTM! The new set up with redux and local storage looks very nice. Have some nit comments and a question about removing the middleware.
packages/kbn-expandable-flyout/src/components/settings_menu.test.tsx
Outdated
Show resolved
Hide resolved
packages/kbn-expandable-flyout/src/components/settings_menu.tsx
Outdated
Show resolved
Hide resolved
f21d1c1 to
ec423bd
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Public APIs missing exports
History
To update your PR or re-run it, just comment with: |
…of hooks (elastic#192745) (cherry picked from commit 31c9e75)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…stead of hooks (#192745) (#193225) # Backport This will backport the following commits from `main` to `8.x`: - [[kbn-expandable-flyout] - refactor push/overlay to use redux instead of hooks (#192745)](#192745) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Philippe Oberti","email":"philippe.oberti@elastic.co"},"sourceCommit":{"committedDate":"2024-09-17T20:15:40Z","message":"[kbn-expandable-flyout] - refactor push/overlay to use redux instead of hooks (#192745)","sha":"31c9e75f56fefb18d6ad1e8e53e75c2117c6c343","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat Hunting:Investigations","v8.16.0"],"title":"[kbn-expandable-flyout] - refactor push/overlay to use redux instead of hooks","number":192745,"url":"https://github.com/elastic/kibana/pull/192745","mergeCommit":{"message":"[kbn-expandable-flyout] - refactor push/overlay to use redux instead of hooks (#192745)","sha":"31c9e75f56fefb18d6ad1e8e53e75c2117c6c343"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192745","number":192745,"mergeCommit":{"message":"[kbn-expandable-flyout] - refactor push/overlay to use redux instead of hooks (#192745)","sha":"31c9e75f56fefb18d6ad1e8e53e75c2117c6c343"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Philippe Oberti <philippe.oberti@elastic.co>
Summary
This PR leverages the redux store work done previously and changes the way we save the state of the flyout type (push vs overlay). Instead of using hooks, this PR is now using redux. In the previous PR we had nested the store information under a new top level store state called
panels. This PR introduces a another new top level state calledui. This new state is used to store thepushVsOverlaystate, and will be used in the next PR for all the new resized widths logic.Originally, the pushVsOverlay values were saved for each flyout (using the
urlKey). After discussing this (see comments below), the functionality now saves a unique value that will be applied to all expandable flyouts.Also the value changed by the user is saved in local storage (only if the push vs overlay) option is enabled. The local storage key is
expandableFlyout.uiand we store a simple object:This object will see more properties in the next PR that will add all the resizable logic.
Here are the main changes introduced here:
uitop level slice of stateuiReducerSettingsMenucomponent to render if unnecessaryNone of the changes impact UI and the actual push vs overlay functionality remains unchanged. These are just code improvements!
Checklist
Will help #182526