Publish CommandForm execution state to context and parents - #2538
Conversation
A parent or card toolbar rendering an external submit control had no way to disable or label it: execution state lived only inside the form, and form state was unreachable from outside the provider. Executions are counted rather than flagged, so two in flight keep reporting executing until the last settles - a boolean cleared in a finally reports idle for both as soon as the first one lands. The imperative handle is created once for the component's lifetime and reads through refs, so a callback ref attaches exactly once instead of re-attaching on every parent render. onStateChange exists because a ref cannot re-render a parent, so a handle alone would serve only half of this. children is deliberately untouched: widening it broke a wrapper forwarding CommandFormProps, and memoizing resolved children on the execution flag re-ran the field parse and reverted the user's typed input on submit. Both are covered by specs here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewer context, kept out of the body. This replaces #2531, which was closed unmerged after review returned do-not-ship; the three confirmed blockers there are each eliminated by construction rather than by care. Blocker 1 — typed input reverting on submit. #2531 memoized resolved children on the execution flag, which re-ran the field parse and re-seeded from Blocker 2 — unbound fields from a fragment-returning render prop. No render prop exists; Blocker 3 — boolean cleared in a The
Semver — the measurement behind required FINDING — the zero-blast-radius premise was not exact. Five sites in four files under Mutation evidence — four mutations, no survivors. Each restored via
All results are RED, which cannot be stale under the Gate. Scope limit, decided deliberately. Not verified: |
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)