dillon1000/react

Commit

Fix: Use action implementation at time of dispatch (#29618)

Fixes the behavior of actions that are queued by useActionState to use
the action function that was current at the time it was dispatched, not
at the time it eventually executes.

The conceptual model is that the action is immediately dispatched, as if
it were sent to a remote server/worker. It's the remote worker that
maintains the queue, not the client.

This is another property of actions makes them more like event handlers
than like reducers.
Browse files
Changed paths2 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactDOMForm-test.js ModifiedM packages/react-reconciler/src/ReactFiberHooks.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…