[Flyout System] Update state manager before allowing unmount#9346
Merged
tsullivan merged 6 commits intoelastic:mainfrom Feb 4, 2026
Merged
Conversation
cc6958c to
883e911
Compare
Collaborator
💚 Build SucceededHistory
cc @tsullivan |
Collaborator
💚 Build Succeeded
History
cc @tsullivan |
tkajtoch
reviewed
Feb 3, 2026
Member
tkajtoch
left a comment
There was a problem hiding this comment.
Changes look good. I restarted the pipeline to see if it keeps failing, but it does seem like a flake. I'll get back to this PR tomorrow morning and see if it passed, and if that's the case, I'll approve 👍🏻
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes: elastic/kibana#250177
Why are we making this change?
Fix crash when closing nested flyouts due to state-DOM synchronization race condition.
Previously, when the
onClosecallback triggered component unmounting before thecloseFlyoutaction updated the state manager, a race condition could occur. This caused React to begin DOM cleanup while the Flyout System state still tracked the flyout as active. During this window, Emotion's style injection code could attempt to access DOM nodes that no longer existed, resulting in a white screen crash.The fix: Call
closeFlyout()to update the manager state before invoking the parent'sonClosecallback. This ensures the state manager is synchronized before React begins the unmount cycle, preventing the race condition during portal-to-inline DOM transitions.This issue was particularly visible in production builds with "nested" flyouts. See elastic/kibana#250177 (comment)
Screenshots #
N/A: this is a state management fix in the flyout system
Impact to users
Bug fix, stability
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[ ] Props have proper autodocs (using@defaultif default values are missing) and playground toggles[ ] Checked Code Sandbox works for any docs examplesCode sandbox works the same as before[ ] 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 the changes unblock an issue in a different repo, smoke tested carefully (see Testing EUI features in Kibana ahead of time)[ ] 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)