[EuiDelayRender] Migrate from class to function component - #9949
Merged
Conversation
Behavior is preserved: children stay hidden for the delay duration on mount and again whenever they update, with repeated updates restarting the timer. The one refinement is that re-renders with referentially unchanged children no longer re-trigger the delay, matching the React.memo semantics suggested in issue elastic#9501. Adds unit tests locking in the timing behavior.
|
👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually? |
Contributor
Author
|
CC'ing: @weronikaolejniczak for further visibility. |
Contributor
Author
|
cla/check |
Contributor
|
buildkite test this |
💚 Build Succeeded
|
💚 Build Succeeded
|
weronikaolejniczak
approved these changes
Aug 25, 2026
weronikaolejniczak
left a comment
Contributor
There was a problem hiding this comment.
LGTM 🟢 Thank you for contributing, @Neilblaze 🙏🏻
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 #9501
Converts
EuiDelayRenderfrom a class to a function component. TheshouldComponentUpdaterender gating becomes conditional rendering in the function body, and timer management moves touseEffect, as suggested in the issue's migration notes.Behavior is preserved: children stay hidden on mount and are hidden again whenever they update, with repeated updates restarting the timer, so content only appears once updates have stopped for the configured delay. Two details worth calling out for review:
EuiBasicTable. A dedicated test guards this and fails if the hide is moved into the effect.React.memosemantics the issue suggests. The old class re-hid on every parent re-render because itsshouldComponentUpdatenever inspected props. All in-repo consumers pass fresh JSX children on every render, so nothing changes for them.The component had no unit tests, so this adds a suite locking in the timing behavior. It was written against the class implementation first, and everything passes on the old class too except the unchanged children case described above.
delaybecomes optional in the props type now thatstatic defaultPropsis gone. The runtime default of 500ms is unchanged.API Changes
EuiDelayRenderProps(was required and filled bydefaultProps). Runtime default of 500ms is unchangedImpact Assessment
Internal refactor with no markup, class name, or styling changes. The only behavior difference is the unchanged children case above, which no known consumer relies on.
Impact level: 🟢 Low
Like the other migrations in this effort (#9860, #9879, #9831) this skips a changelog entry, so it needs the
skip-changeloglabel from a maintainer.QA instructions for reviewer
EuiDelayRenderplayground in Storybook.delay_render.a11y.tsx) passes.