Skip to content

[Flyout System] Update state manager before allowing unmount#9346

Merged
tsullivan merged 6 commits intoelastic:mainfrom
tsullivan:flyout/stage-manager-update-before-unmount
Feb 4, 2026
Merged

[Flyout System] Update state manager before allowing unmount#9346
tsullivan merged 6 commits intoelastic:mainfrom
tsullivan:flyout/stage-manager-update-before-unmount

Conversation

@tsullivan
Copy link
Copy Markdown
Member

@tsullivan tsullivan commented Jan 30, 2026

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 onClose callback triggered component unmounting before the closeFlyout action 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's onClose callback. 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

  • Browser QA
    • [ ] Checked in both light and dark modes
    • [ ] Checked in both MacOS and Windows high contrast modes
    • [ ] Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • [ ] 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)
  • Designer 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)

@tsullivan tsullivan force-pushed the flyout/stage-manager-update-before-unmount branch from cc6958c to 883e911 Compare January 30, 2026 20:28
@tsullivan tsullivan added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Feb 2, 2026
@tsullivan tsullivan self-assigned this Feb 2, 2026
@tsullivan tsullivan marked this pull request as ready for review February 3, 2026 18:05
@tsullivan tsullivan requested a review from a team as a code owner February 3, 2026 18:06
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @tsullivan

@elasticmachine
Copy link
Copy Markdown
Collaborator

elasticmachine commented Feb 3, 2026

💚 Build Succeeded

History

cc @tsullivan

Copy link
Copy Markdown
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

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 👍🏻

Copy link
Copy Markdown
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

🚢

@tsullivan tsullivan merged commit d9eb982 into elastic:main Feb 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1️⃣ [Discover][Traces] Investigate white screen crash when closing nested flyouts in builds

3 participants