Say which formRef shapes attach once, and pin the in-flight reading - #2542
Conversation
The handle object is created once, but the docs concluded from that a callback ref attaches exactly once. React re-attaches whenever the ref itself changes identity, so an inline arrow re-attaches every render - and paired with a state setter that is a re-render loop, which is the very failure the note claimed to rule out. Say stable ref instead. The rejection spec asserted only that the form stopped executing, which an implementation that never started executing also satisfies. It now reads while the command is in flight: dropping the state publish leaves the old assertion green and turns the new one red. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewer context, kept out of the body. Why the body lists the #2497 surface even though this PR is small. #2497 merged as #2538 ( The two changes here are both independent-review findings against #2538.
Worth recording a process note: the first attempt at that mutation left the tree dirty. The Gate. |
Added
useIsCommandExecutingfor reading whether aCommandForm's command is currently executing (CommandForm exposes neither execution state nor parent-reachable form state #2497)formRefonCommandForm, exposingexecute()plusisExecuting,isValidandisAuthorizedto a parent rendering its own submit control (CommandForm exposes neither execution state nor parent-reachable form state #2497)onStateChangeonCommandForm, notifying a parent when execution, validity or authorization changes (CommandForm exposes neither execution state nor parent-reachable form state #2497)isExecutingon the command form context (CommandForm exposes neither execution state nor parent-reachable form state #2497)Fixed
formRefdocumentation no longer implies an inline callback ref attaches only once; it attaches on every render, so a stable ref is required (CommandForm exposes neither execution state nor parent-reachable form state #2497)