-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Refactor rich-text to match the react-hooks/exhaustive-deps
eslint rules
#27963
Conversation
Size Change: +272 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
wrapperProps: omit( wrapperProps, [ 'data-align' ] ), | ||
}; | ||
const memoizedValue = useMemo( () => value, Object.values( value ) ); | ||
const wrapperPropsOmitAlign = omit( wrapperProps, [ 'data-align' ] ); |
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.
Won't this always return a new array?
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.
Oops, you're right!
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.
Just found out that doesn't that mean the original way of doing this also will create a new array for each render?
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.
Yes, you're right. It seems fine to just pass the each wrapper props and include the data attribute in that case.
* @param {Function} effect The effect callback passed to `useEffect`. | ||
* @param {Array} deps The dependency array that is compared against shallowly. | ||
*/ | ||
function useShallowCompareEffect( effect, deps ) { |
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.
Why do we need new APIs just to work around the rule? Why can't we disable the rule for this particular instance?
I don't understand the need to introduce new APIs at all in this PR, unless it's going to be used in multiple places. Maybe we should just focus on fixing the dependencies in this PR?
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.
Hmm, yeah it makes sense, not sure why I included it in the first place.
Description
It's the same as in #25064, I accidentally merged it into a wrong base branch. Since it's been a while, reopen this to get a fresh round of reviews.
How has this been tested?
react-hooks/exhaustive-deps
rule by rebasing this branch onto Enable react-hooks/exhaustive-deps eslint rules #24914.npm run lint-js
Types of changes
Bug fix
Checklist: