You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[EuiFilePicker] Migrate from class to function component #9495
help wantedThe EUI team is unlikely prioritize. (Don't delete - used for automation)low hanging fruitAn issue, often a bug, that is lower effort and clearly ought to be fixed
I'd like to take this one — the migration is working locally and I'll open a PR shortly.
Approach: useState for promptText/isHoveringDrop, useRef for the file input, useFormContext() in place of static contextType, and useEuiMemoizedStyles replacing the withEuiStylesMemoizer HOC (so the EuiFilePickerClass export goes away — it isn't re-exported from index.ts, so this stays internal-only).
Two notes from working through it:
The description lists Lifecycle: None, but there is a componentDidUpdate that re-derives promptText when the files prop changes (the file is 382 lines now, not 262). I've preserved the exact semantics with a useEffect plus a previous-value ref so it doesn't also fire on mount — a bare [files] effect would cause a redundant second render in the multi-file case, since getPromptTextFromFileList returns a fresh EuiI18n element each call.
Verification so far: all 13 existing file_picker tests pass with the snapshot unchanged, and the wider src/components/form suite (38 suites / 382 tests / 222 snapshots) is green, along with tsc --noEmit and ESLint.
@mehuljariwala ah, all these were generated with an agent so there might be these small mistakes. Thanks for raising it, I updated in the description. Also, thank you for considering useGeneratedHtmlId() 🙏🏻 This is very important for us to move forward to SSR-friendly EUI.
👋 Thank you for your suggestion or request! While the EUI team agrees that it's valid, it's unlikely that we will prioritize this issue on our roadmap. We'll leave the issue open if you or anyone else in the community wants to implement it by contributing to EUI. If not, this issue will auto close in one year.
help wantedThe EUI team is unlikely prioritize. (Don't delete - used for automation)low hanging fruitAn issue, often a bug, that is lower effort and clearly ought to be fixed
Activity
mehuljariwala commentedon Aug 8, 2026
I'd like to take this one — the migration is working locally and I'll open a PR shortly.
Approach:
useStateforpromptText/isHoveringDrop,useReffor the file input,useFormContext()in place ofstatic contextType, anduseEuiMemoizedStylesreplacing thewithEuiStylesMemoizerHOC (so theEuiFilePickerClassexport goes away — it isn't re-exported fromindex.ts, so this stays internal-only).Two notes from working through it:
The description lists Lifecycle: None, but there is a
componentDidUpdatethat re-derivespromptTextwhen thefilesprop changes (the file is 382 lines now, not 262). I've preserved the exact semantics with auseEffectplus a previous-value ref so it doesn't also fire on mount — a bare[files]effect would cause a redundant second render in the multi-file case, sincegetPromptTextFromFileListreturns a freshEuiI18nelement each call.I also swapped
htmlIdGenerator()()foruseGeneratedHtmlId()here, which clears one more function-component usage tracked in [SSR] Replace htmlIdGenerator usages with useGeneratedHtmlId in all function components #7093.Verification so far: all 13 existing
file_pickertests pass with the snapshot unchanged, and the widersrc/components/formsuite (38 suites / 382 tests / 222 snapshots) is green, along withtsc --noEmitand ESLint.weronikaolejniczak commentedon Aug 10, 2026
@mehuljariwala ah, all these were generated with an agent so there might be these small mistakes. Thanks for raising it, I updated in the description. Also, thank you for considering
useGeneratedHtmlId()🙏🏻 This is very important for us to move forward to SSR-friendly EUI.github-actions commentedon Aug 10, 2026
👋 Thank you for your suggestion or request! While the EUI team agrees that it's valid, it's unlikely that we will prioritize this issue on our roadmap. We'll leave the issue open if you or anyone else in the community wants to implement it by contributing to EUI. If not, this issue will auto close in one year.