Skip to content

Comments

[Docs only] Fix EuiFilePicker example file list on Firefox#5064

Merged
cee-chen merged 1 commit intoelastic:masterfrom
cee-chen:file-picker-example-firefox
Aug 23, 2021
Merged

[Docs only] Fix EuiFilePicker example file list on Firefox#5064
cee-chen merged 1 commit intoelastic:masterfrom
cee-chen:file-picker-example-firefox

Conversation

@cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Aug 20, 2021

Summary

I noticed this while QA testing #5063 locally - my file list in the file picker doc example wasn't updating when I added/updated existing files, only on new file add:

before

(note how trial does not update to match gold, and 3 files are listed in the picker but not on the right)

After some digging, this appears to be because I'm a Firefox user, and Firefox for some reason is mutating the existing FileList in place, which fails to trigger a React state change 🤦‍♀️ (facebook/react#18104)

There's a relatively simple Array.from(FileList) workaround you can use to correctly trigger state changes, which I thought was worth implementing both to fix this behavior and as an example to other dev users who may run into the same issue at some point in the future 🤷

Fixed behavior on FF:

after

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile

  • Checked in Chrome, Safari, Edge, and Firefox

- [ ] Props have proper autodocs and playground toggles

- [ ] Checked Code Sandbox works for the any docs examples
- [ ] Added or updated jest tests
- [ ] Checked for breaking changes and labeled appropriately
- [ ] Checked for accessibility including keyboard-only and screenreader modes
- [ ] A changelog entry exists and is marked appropriately

@cee-chen cee-chen added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Aug 20, 2021
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5064/

@cee-chen
Copy link
Contributor Author

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5064/

@cee-chen
Copy link
Contributor Author

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5064/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Good catch ⚾ Confirmed with the docs preview build

@cee-chen cee-chen merged commit 264dc89 into elastic:master Aug 23, 2021
@cee-chen cee-chen deleted the file-picker-example-firefox branch August 23, 2021 14:39
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.

3 participants