-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Components: refactor Autocomplete to pass exhaustive-deps
#41382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Size Change: +11 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM 🚀
There are no unit tests and no Storybook examples for this component, which gives us a bit less confidence when making changes. We should add those soon-ish — at least the unit tests before the TypeScript migration.
I gave the component a quick look in the editor

but it's probably better if you could give it a second look too, before merging (given the lack of unit tests).
e7ebfd1 to
7a4e125
Compare
|
Thanks @ciampo! The lack of stories or tests gave me pause as well, but I also had good results from manual testing. I also took the slash inserter for a spin and that's working as expected as well so I think we're in good shape 🤞 Thanks again for the review! |
…e `onChangeOptions`
…ion` `useCallback` dependency arrays
7a4e125 to
720c7c4
Compare
* update `AutoCompleterUI` `useLayoutEffect` dependency array to include `onChangeOptions` * update `AutoCompleterUI` native.js `useLayoutEffect` and `startAnimation` `useCallback` dependency arrays * update `useAutocomplete` `useEffect` dependency array * Autocomplete: rebase and fix changelog merge conflict
What?
Updates the
Autoompletecomponent to satisfy theexhaustive-depseslint ruleWhy?
Part of the effort in #41166 to apply
exhuastive-depsto the Components packageHow?
AutocompleterUI
onChangeOptionsto theuseEffectdependency arrayAutocompleterUI native.js
onChangeOptionsandstartAnimationto theuseEffectdependency arrayanimationValueandresettostartAnimation'suseCallbackuseAutoComplete
AutocompleterUI,autocompleter,completers,recordandfilteredOptions.lengthto theuseEffectdependency arrayTesting Instructions
npx eslint --rule 'react-hooks/exhaustive-deps: warn' packages/components/src/autocomplete