dillon1000/react
Commit
Browse files useFormState: MPA submissions to a different page (#27372)
The permalink option of useFormState controls which page the form is submitted to during an MPA form submission (i.e. a submission that happens before hydration, or when JS is disabled). If the same useFormState appears on the resulting page, and the permalink option matches, it should receive the form state from the submission despite the fact that the keypaths do not match. So the logic for whether a form state instance is considered a match is: - Both instances must be passed the same action signature - If a permalink is provided, the permalinks must match. - If a permalink is not provided, the keypaths must match. Currently, if there are multiple matching useFormStates, they will all match and receive the form state. We should probably only match the first one, and/or warn when this happens. I've left this as a TODO for now, pending further discussion.
Changed paths2 files
First-parent comparisonpackages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js ModifiedM packages/react-server/src/ReactFizzHooks.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…