Skip to content

[EuiDelayHide] Migrate from class to function component - #9919

Open
AmirmAfzal wants to merge 3 commits into
elastic:mainfrom
AmirmAfzal:migrate/delay-hide-function-component
Open

[EuiDelayHide] Migrate from class to function component#9919
AmirmAfzal wants to merge 3 commits into
elastic:mainfrom
AmirmAfzal:migrate/delay-hide-function-component

Conversation

@AmirmAfzal

Copy link
Copy Markdown

Summary

  • What: Migrates EuiDelayHide from a class component to a function component using hooks.
  • Why: Part of the ongoing effort to modernize EUI components. No behavior changes.
  • How: Replaced the class lifecycle methods (getDerivedStateFromProps, componentDidMount, componentDidUpdate, componentWillUnmount) with useState, useRef, and useEffect. Kept the same delay-timing logic, including the single in-flight timer guard and the unmount cleanup.

API Changes

component / parent prop / child change description
EuiDelayHide hide Default Now optional with a default of false (previously required with defaultProps)
EuiDelayHide minimumDuration Default Now optional with a default of 1000 (previously required with defaultProps)

Screenshots

N/A — no visual changes; this is an internal implementation refactor.

Before After
N/A N/A

Impact Assessment

No consumer-facing behavior changes. The public API surface is identical at runtime; only the TypeScript types for hide and minimumDuration became optional (matching their existing defaultProps).

Impact level: 🟢 None

Release Readiness

  • Documentation: No docs page changes needed
  • Figma: No design changes
  • Migration guide: Not a breaking change
  • Adoption plan Not a new feature

QA instructions for reviewer

  • Open the EuiDelayHide story in Storybook
  • Confirm the content stays visible for the default 1000ms after hide becomes true
  • Confirm toggling hide back to false immediately shows the content again
  • Confirm a custom minimumDuration (e.g. 2000) is respected

Checklist before marking Ready for Review

  • Filled out all sections above
  • QA: Tested light/dark modes, high contrast, mobile, browsers No visual changes; unit tests cover the timing behavior
  • QA: Tested in CodeSandbox and Kibana Internal refactor; unit tests + Storybook used
  • Tests: Added/updated Jest, Cypress, and VRT Existing tests unchanged and passing (13/13)
  • Changelog: Will add changelog entry once PR number is known

Reviewer checklist

  • Approved Impact Assessment — No consumer impact
  • Approved Release Readiness — No docs/Figma/migration needed

@AmirmAfzal
AmirmAfzal requested a review from a team as a code owner August 15, 2026 17:36
@cla-checker-service

cla-checker-service Bot commented Aug 15, 2026

Copy link
Copy Markdown

💚 CLA has been signed

@github-actions

Copy link
Copy Markdown

👋 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?

@github-actions github-actions Bot added the community contribution (Don't delete - used for automation) label Aug 15, 2026
@AmirmAfzal

Copy link
Copy Markdown
Author

👋 Just signed the CLA. Could a maintainer approve the workflow run and kick off the Buildkite build when convenient? Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This changelog is not needed because refactoring to a function component is an internal change, not consumer-facing. We can drop it 😄

@weronikaolejniczak

Copy link
Copy Markdown
Contributor

buildkite test this

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Migrates EuiDelayHide (in packages/eui) from a React class component to a function component using hooks, while preserving the existing delay-to-hide behavior and default prop values (now expressed via parameter defaults and optional TS props).

Changes:

  • Refactored lifecycle/state logic to useState, useRef, and useEffect, keeping the existing single in-flight timer behavior and unmount cleanup.
  • Updated TypeScript props so hide and minimumDuration are optional (with defaults false and 1000).
  • Added an upcoming changelog entry documenting the conversion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/eui/src/components/delay_hide/delay_hide.tsx Replaces class lifecycle methods with hooks while keeping the same render/timer semantics and defaults.
packages/eui/changelogs/upcoming/9919.md Adds a changelog entry noting the component conversion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
44 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euiicon (2 differences)

StoryBeforeAfterDiff
all icons desktop
all icons mobile

euicombobox (9 differences)

StoryBeforeAfterDiff
custom matcher desktop
custom truncation desktop
default truncation desktop
groups desktop
icons and many options selected desktop
nested options groups desktop
playground desktop
row height auto desktop
with tooltip desktop

euiform (1 difference)

StoryBeforeAfterDiff
playground mobile

euiinlineedittext (2 differences)

StoryBeforeAfterDiff
edit mode mobile
playground mobile

euiflexgrid (1 difference)

StoryBeforeAfterDiff
playground desktop

euiflyout (14 differences)

StoryBeforeAfterDiff
playground desktop
playground mobile
playground desktop
playground mobile
playground desktop
playground mobile
playground desktop
playground mobile
pagination example desktop
pagination example mobile
playground desktop
playground mobile
playground desktop
playground mobile

euiheader (4 differences)

StoryBeforeAfterDiff
elastic navigation pattern desktop
elastic navigation pattern mobile
multiple fixed headers mobile
popover example mobile

euicollapsiblenav (4 differences)

StoryBeforeAfterDiff
full header pattern desktop
full header pattern mobile
playground desktop
playground mobile

euicontextmenu (1 difference)

StoryBeforeAfterDiff
playground desktop

euikeypadmenu (1 difference)

StoryBeforeAfterDiff
playground mobile

euidatagrid (4 differences)

StoryBeforeAfterDiff
full screen with flyout mobile
column selector desktop
column selector mobile
toolbar visibility options desktop

euitable (1 difference)

StoryBeforeAfterDiff
playground mobile

@weronikaolejniczak

Copy link
Copy Markdown
Contributor

buildkite test this

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@weronikaolejniczak

Copy link
Copy Markdown
Contributor

Could you also make sure this component works with StrictMode? 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants