Ensure dispatch from useFormState works in StrictMode - #28557
Conversation
|
Comparing: bbc571a...e32f38a Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
useFormState in StrictModeuseFormState works in StrictMode
f792c17 to
1c4e7c4
Compare
1c4e7c4 to
9b3f1f3
Compare
useFormState works in StrictModeuseFormState works in StrictMode
| } | ||
|
|
||
| // For mount, pending is always false. | ||
| const [isPending] = rerenderState(false); |
There was a problem hiding this comment.
Since we don't actually need the result, all we need to do is advance the hook list.
| const [isPending] = rerenderState(false); | |
| updateWorkInProgressHook(); |
There was a problem hiding this comment.
Feels a bit brittle but you know this part better than I do.
There was a problem hiding this comment.
I consider this pretty low level code so I think it's fine. I care more about not observing the value of isPending since it causes a bunch of redundant read operations.
commented
Mar 19, 2024
|
This was introduced by #28514. Easy oversight to make, glad we caught it quickly. Note that it doesn't just affect StrictMode, the same issue happen if you called |
Co-Authored-By: Andrew Clark <git@andrewclark.io>
Summary
Closes #28556
We didn't follow the Rules of Hooks in the rerender implementation for mounts.
Test plan