-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
PaletteEditListView
: add missing deps to useEffect
dep array
#43911
PaletteEditListView
: add missing deps to useEffect
dep array
#43911
Conversation
PaletteEditListView
: add missing deps to useEffect dep arrayPaletteEditListView
: add missing deps to useEffect
dep array
5ba042e
to
b9e161b
Compare
Unfortunately no Storybook example was added for this component. It looks like this component is used in the Global Styles sidebar, in the Site Editor — I took this PR for a spin and noticed that it introduces a regression when trying to add a new color to the palette: Kapture.2022-09-10.at.18.50.38.mp4It looks the changes from this PR make the cleanup function from We have a couple of choices:
In the process, it would be also great if we could add unit tests to catch this regression in the future. |
It looks like this is happening because:
To test this theory, I tried quickly wrapping Screen.Recording.2022-09-14.at.15.42.01.movSorting out that first usage of the |
Circling back to this one... I'm thinking it might make the most sense to revert the changes related to |
Sounds like a plan to me |
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.
- try to change the logic of the component so that effectively the "cleanup" is run only when the user is done editing the palette (@jorgefilipecosta may help here?)
I was not involved in coding this logic, so I don't have many insights. But It sounds like the logic was added there as a workaround that we want to run when unmounting, so adding the missing deps would break the logic. I don't think we should invest much time into this, so probably a lint ignore comment is the way to go here.
Hey @flootr , do you intend to pick this PR up or should we close it? |
Let's close it for now. I'll add a note to follow up. |
What?
Updates the
PaletteEditListView
component to satisfy theexhaustive-deps
eslint ruleWhy?
Part of the effort in #41166 to apply
exhaustive-deps
to the Components packageHow?
Add the
onChange
prop &slugPrefix
to theuseCallback
dependency array.Testing Instructions
npx eslint --rule 'react-hooks/exhaustive-deps: warn' packages/components/src/palette-edit