Inline edit: text that becomes editable in place, with a committed value distinct from the
pending one.
The machine owns the pending text, which state the field is in, the activation gesture, Enter /
Escape, and what an interaction outside the field does with the edit. This owns the thing it has
no notion of — the committed value — so onValueChange fires when an edit lands rather than on
every keystroke.
The value. Controlled with value, uncontrolled with defaultValue; draft is the pending
text either way and only ever reaches onValueChange on a commit. A controlled host that does not
echo a commit back is refusing it, and the field returns to the value the host still holds.
Who owns the edit state. Left alone, the machine does: the field opens on activation and
closes on Enter, Escape, or an interaction outside it. Passing editing takes that ownership,
which is what a pane editor does — the pane IS the editor, so it is held open and never closes.
The machine then treats a submit as a request to whoever holds the prop and announces only the
state change, so commit and revert here act on it directly rather than waiting to be told.
Either way an edit is delivered exactly once.
Commit and revert.commit writes the pending text — or the text it is handed, for a caller
that already holds it and must not race the draft. revert restores the last committed text and
discards the rest, including on a field that was empty when it opened, which the machine alone
would leave holding the discarded text.
Inline edit: text that becomes editable in place, with a committed value distinct from the pending one.
The machine owns the pending text, which state the field is in, the activation gesture,
Enter/Escape, and what an interaction outside the field does with the edit. This owns the thing it has no notion of — the committed value — soonValueChangefires when an edit lands rather than on every keystroke.The value. Controlled with
value, uncontrolled withdefaultValue;draftis the pending text either way and only ever reachesonValueChangeon a commit. A controlled host that does not echo a commit back is refusing it, and the field returns to the value the host still holds.Who owns the edit state. Left alone, the machine does: the field opens on
activationand closes onEnter,Escape, or an interaction outside it. Passingeditingtakes that ownership, which is what a pane editor does — the pane IS the editor, so it is held open and never closes. The machine then treats a submit as a request to whoever holds the prop and announces only the state change, socommitandreverthere act on it directly rather than waiting to be told. Either way an edit is delivered exactly once.Commit and revert.
commitwrites the pending text — or the text it is handed, for a caller that already holds it and must not race the draft.revertrestores the last committed text and discards the rest, including on a field that was empty when it opened, which the machine alone would leave holding the discarded text.