[Flyout System] export flyout manager store for read-only subscription#9347
Conversation
00cceed to
090a579
Compare
|
@tsullivan why are we not adding a change log here? 🤔 I'd treat this as an enhancement and say something along the lines of "Exported the flyout system store singleton and added an event observer for emitting close session events". I imagine this is so that consumers can subscribe to the "close" event, fixing this issue, right? Writing that part and the proper usage in the change log would also be beneficial. For the future, this would make it easy for consumers to scan what changed with each version, and what EUI change could've potentially influenced a certain behavior. |
|
Hi @weronikaolejniczak thanks for taking a look!
Sorry that I have neglected to explain, in order to use the Flyout System Examples in Kibana, you must run Kibana from source with the |
Sorry, I am too used to working in Kibana where we often skip release notes for small fixes that end-users do not notice. I have added the changelog, take a look :) |
💚 Build SucceededHistory
|
💚 Build Succeeded
History
|
There was a problem hiding this comment.
Thank you for adding the changelog!
weronikaolejniczak
left a comment
There was a problem hiding this comment.
Thanks for sharing the additional details!
I tested the change in Kibana using a reproducible issue example made by @akowalska622 🙌🏻 It makes it super clear what is the problem. After applying your changes and building local EUI from the branch, I verified that the issue is fixed.
We're good to go, Tim! 🟢
| Before | After |
|---|---|
Kapture.2026-02-09.at.12.08.36.mp4 |
Kapture.2026-02-09.at.12.24.20.mp4 |
## Dependency updates - `@elastic/eui`: v112.2.0 ⏩ v112.3.0 - `@elastic/eslint-plugin-eui`: v2.7.0 ⏩ v2.8.0 --- ## Package updates ### `@elastic/eui` [v112.3.0](https://github.com/elastic/eui/releases/tag/v112.3.0) - Added new `server` icon. ([#9355](elastic/eui#9355)) - Added `className` support to `EuiMarkdownEditor`'s `toolbarProps` for custom toolbar styling ([#9349](elastic/eui#9349)) - Updated `EuiFilePicker` to use the `upload` icon to better indicate uploads. ([#9351](elastic/eui#9351)) - Exported the flyout system store singleton and added an event observer for emitting close session events ([#9347](elastic/eui#9347)) - Updated `EuiIcon` to use standard dynamic imports for icon assets, enabling native support for modern bundlers (Rollup, Parcel) and improving initial load performance ([#9342](elastic/eui#9342)) **Bug fixes** - Fixed a potential crash in the flyout system: due to asynchronous state updates and React's batching behavior, it was possible to experience a crash when closing a managed flyout. ([#9356](elastic/eui#9356)) ### `@elastic/eslint-plugin-eui` v2.8.0 - Added new `icon-accessibility-rules` rule. ([#9357](elastic/eui#9357)) - Added new `badge-accessibility-rules` rule. ([#9354](elastic/eui#9354))
…scade close (#251146) ## Summary Depends on elastic/eui#9347 Closes: elastic/kibana-team#2725 This PR updates Kibana’s `SystemFlyoutService` to listen to the EUI flyout manager’s `CLOSE_SESSION` events and close imperative flyout roots when their session is removed. This makes cascade-close work for `openSystemFlyout()` flows that render in separate React roots. The flyout system example is adjusted to stop manually closing child refs so it reflects system behavior. **Key changes** - Subscribe to `getFlyoutManagerStore().subscribeToEvents` and close matching flyouts on `CLOSE_SESSION`. - Make `SystemFlyoutRef.isClosed` a getter backed by a private flag. - Remove manual child close from the flyout system example. **Notes** - Depends on EUI export of `subscribeToEvents` and `CLOSE_SESSION` events (see EUI PR elastic/eui#9347). ### Testing 1. Run Kibana from source locally with example plugins ``` yarn start --run-examples ``` 2. Navigate to `http://localhost:5601/app/flyoutSystemExamples` 3. Make sure the child flyout is automatically closed when testing the `Session X` flyout, as shown in the following screen recording. https://github.com/user-attachments/assets/d645b9a0-1ad7-45e2-8966-35da03b0c341 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - ~~[ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~~ - ~~[ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials~~ - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - ~~[ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list]~~(https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - ~~[ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations.~~ - ~~[ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed~~ - ~~[ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)~~ - ~~[ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.~~ ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. None
…scade close (elastic#251146) ## Summary Depends on elastic/eui#9347 Closes: elastic/kibana-team#2725 This PR updates Kibana’s `SystemFlyoutService` to listen to the EUI flyout manager’s `CLOSE_SESSION` events and close imperative flyout roots when their session is removed. This makes cascade-close work for `openSystemFlyout()` flows that render in separate React roots. The flyout system example is adjusted to stop manually closing child refs so it reflects system behavior. **Key changes** - Subscribe to `getFlyoutManagerStore().subscribeToEvents` and close matching flyouts on `CLOSE_SESSION`. - Make `SystemFlyoutRef.isClosed` a getter backed by a private flag. - Remove manual child close from the flyout system example. **Notes** - Depends on EUI export of `subscribeToEvents` and `CLOSE_SESSION` events (see EUI PR elastic/eui#9347). ### Testing 1. Run Kibana from source locally with example plugins ``` yarn start --run-examples ``` 2. Navigate to `http://localhost:5601/app/flyoutSystemExamples` 3. Make sure the child flyout is automatically closed when testing the `Session X` flyout, as shown in the following screen recording. https://github.com/user-attachments/assets/d645b9a0-1ad7-45e2-8966-35da03b0c341 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - ~~[ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~~ - ~~[ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials~~ - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - ~~[ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list]~~(https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - ~~[ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations.~~ - ~~[ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed~~ - ~~[ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)~~ - ~~[ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.~~ ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. None
…scade close (elastic#251146) ## Summary Depends on elastic/eui#9347 Closes: elastic/kibana-team#2725 This PR updates Kibana’s `SystemFlyoutService` to listen to the EUI flyout manager’s `CLOSE_SESSION` events and close imperative flyout roots when their session is removed. This makes cascade-close work for `openSystemFlyout()` flows that render in separate React roots. The flyout system example is adjusted to stop manually closing child refs so it reflects system behavior. **Key changes** - Subscribe to `getFlyoutManagerStore().subscribeToEvents` and close matching flyouts on `CLOSE_SESSION`. - Make `SystemFlyoutRef.isClosed` a getter backed by a private flag. - Remove manual child close from the flyout system example. **Notes** - Depends on EUI export of `subscribeToEvents` and `CLOSE_SESSION` events (see EUI PR elastic/eui#9347). ### Testing 1. Run Kibana from source locally with example plugins ``` yarn start --run-examples ``` 2. Navigate to `http://localhost:5601/app/flyoutSystemExamples` 3. Make sure the child flyout is automatically closed when testing the `Session X` flyout, as shown in the following screen recording. https://github.com/user-attachments/assets/d645b9a0-1ad7-45e2-8966-35da03b0c341 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - ~~[ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~~ - ~~[ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials~~ - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - ~~[ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list]~~(https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - ~~[ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations.~~ - ~~[ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed~~ - ~~[ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)~~ - ~~[ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.~~ ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. None

Summary
Why are we making this change?
Needed for Kibana PR elastic/kibana#251146 to close https://github.com/elastic/kibana-team/issues/2725
We need a public export for the flyout manager store (e.g.,
getFlyoutManagerStore()and minimal state types) so integrations that use imperative flyouts or create flyouts in separate React roots can subscribe to state changes and clean up imperative roots when sessions are removed.Why this is needed
core.overlays.openSystemFlyout(), that renders flyouts imperatively and creates a new React root per flyout.useSyncExternalStore, so state changes are visible across roots — but unmounting of the child’s React root is still imperative and must be triggered by Kibana when the session disappears.CLOSE_SESSIONevent when sessions are removed, which downstream consumers can subscribe to.Why a store export is the minimal safe option
CLOSE_SESSIONevents, so imperative roots can unmount when a session is closed.New exports in the EUI API surface
getFlyoutManagerStore()(already exists internally)FlyoutManagerStoretype (optional but helpful)EuiFlyoutManagerState/FlyoutSessiontypes (optional, for typed access)FlyoutManagerEventtype (includesCLOSE_SESSION) andsubscribeToEvents()on the storeImpact to users
Testing
Recording
flyout.system.example.-.core-overlays-service.mp4
QA
Remove or strikethrough items that do not apply to your PR.
General checklist
[ ] Checked in both light and dark modes[ ] Checked in both MacOS and Windows high contrast modes(emulate forced colors if you do not have access to a Windows machine.)[ ] Checked in mobile[ ] Checked in Chrome, Safari, Edge, and Firefox[ ] Checked for accessibility including keyboard-only and screenreader modes[ ] Props have proper autodocs (using@defaultif default values are missing) and playground toggles[ ] Checked Code Sandbox works for any docs examples[ ] Added or updated jest and cypress tests[ ] Updated visual regression tests[ ] A changelog entry exists and is marked appropriately[ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)[ ] If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)