-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Failing test: Switch between zero and non-zero Hooks #24438
base: main
Are you sure you want to change the base?
Conversation
Comparing: bd4784c...86e6b0e 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) |
I suspect this check is the reason: react/packages/react-reconciler/src/ReactFiberHooks.new.js Lines 407 to 411 in bd4784c
Because of it, we end up using the "mount" dispatcher during an update. |
I did a bit of experimentation to see how the Each group corresponds to one mount -> update case.
|
Possible fix here: #24535 |
Rendering Hooks conditionally is not supported. Linter enforces this.
However, people sometimes forget to use the linter. We should hard-error in this case. See #24391 for an example.
It looks like we hard-error when the number of Hooks changed, but not between 0 Hooks and non-0 Hooks. This adds failing tests that show the issue.