-
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
Components: refactor ColorPalette
to disable exhaustive-deps
check for now
#41253
Conversation
isSelectedCustom()
in useCallback
to ensure re…ColorPalette
to pass exhaustive-deps
Size Change: 0 B Total Size: 1.24 MB ℹ️ View Unchanged
|
Added @geriux too in order to have a reviewer with more experience on React native (in case) |
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, but as I said previously, I'd prefer if the approval was given by someone more confident with React native (and its testing/building processes)
cf25a13
to
7a5f206
Compare
Good catch! Weird that the linter didn't catch it though |
9564af3
to
b37de51
Compare
@geriux would you be able to take another look? Thank you! |
Thanks for updating the code! I've tested again and I found another issue with the We can keep the This is the issue we have with the ColorPalette.mov |
Thank you @geriux for taking another look!
This is usually a code smell, hinting that the code could be rewritten differently. I looked into the code a bit more, and noticed that the If we have to disable What do folks think? |
Definitely, adding more things to the dependencies list might cause other side effects not expected when this component was created. And I agree that it would need to be refactored a so it works correctly.
I like that suggestion, until we have some time to check that component and make the necessary code changes. I'm actually happy we are planning to add the |
Sounds like trying to get this one safely passing |
b37de51
to
da92d8f
Compare
ColorPalette
to pass exhaustive-deps
ColorPalette
to disable exhaustive-deps
check for now
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.
LGTM 🚀 — thank you @chad1008 for taking the time to work on this, even if we didn't "fix" the issue, this was definitely not wasted time!
+1 to that! Thank you! |
da92d8f
to
87f6779
Compare
What?
Updates the
ColorPalette
component to satisfy theexhaustive-deps
eslint ruleWhy?
Part of the effort in #41166 to apply
exhuastive-deps
to the Components packageHow?
isSelectedCustom
to theuseEffect
dependency arrayisSelectedCustom
inuseCallback
to allow for a stable reference between renders, rather than having the function get redeclared each time.Testing Instructions
exhaustive-deps
eslint rule #41166, OR manually set'react-hooks/color-palette': 'warn'
in your local eslint filenpx eslint packages/components/src/color-palette