-
Notifications
You must be signed in to change notification settings - Fork 49.7k
[Fiber] Ensure useEffectEvent reads latest values in forwardRef and memo() Components
#34831
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
| logContextValue = fireLogContextValue; | ||
| }, []); |
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.
The original report registered an interval here. Even after rendering with a new context value, the interval continued to log the initial value.
|
Comparing: 1d68bce...6bec011 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
forwardRef and memo() ComponentsuseEffectEvent reads latest values in forwardRef and memo() Components
[diff facebook/react@ead92181...d7215b49](facebook/react@ead9218...d7215b4) <details> <summary>React upstream changes</summary> - facebook/react#34829 - facebook/react#34827 - facebook/react#34824 - facebook/react#34823 - facebook/react#34831 - facebook/react#34821 </details>
Closes #34818
Seems to me the event payload handling should've gone into the original fallthrough block instead of just handling it for
FunctionComponent: https://github.com/facebook/react/pull/25229/files#diff-9e8ee221dbf99e0ccdad6a63bf63804dea26f1785e2f443dbe92fa835a63b83eL412-L415See first commit for current behavior where Effect Events did not read the latest Context value if used in
React.memoComponents.