Skip to content

Confirm edit-state cleanup bug already fixed; no code changes#315

Closed
Copilot wants to merge 1 commit into
v2.0-devfrom
copilot/edit-state-cleanup
Closed

Confirm edit-state cleanup bug already fixed; no code changes#315
Copilot wants to merge 1 commit into
v2.0-devfrom
copilot/edit-state-cleanup

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 3, 2026

The issue reports that three non-EditButtons paths into editing (ValueNodeWrapper setIsEditing, CollectionNode setIsEditing, CollectionNode EditButtons click) called startEdit(path) without a cancelOp, leaving stale local state (value / stringifiedValue / previousValue) on the previous node when the edit transitioned.

Verification

All three call sites now register a cancelOp — no further changes required:

  • src/ValueNodeWrapper.tsx:420setIsEditing: canEdit ? () => startEdit(path, { cancelOp: revertSession }) : NOOP. revertSession (line 370) applies and clears the previousValue snapshot.
  • src/CollectionNode.tsx:523 — custom-node setIsEditing: () => startEdit(path, { cancelOp: clearEditBuffer }).
  • src/CollectionNode.tsx:546EditButtons click handler now also passes { cancelOp: clearEditBuffer }. clearEditBuffer (line 173) resets stringifiedValue.

Inline comments at both revertSession and clearEditBuffer explicitly document the "edit moves to another node" path the issue describes, matching the proposed fix in intent and shape.

Out of scope

KeyDisplay.tsx:126 still calls startEdit(path) without a cancelOp, but that's on the key-edit path — not one of the three sites enumerated in the issue.

Optional follow-up

The issue suggests a behavioural regression test ("transitioning edits via double-click resets the previous node's local state"). Not added here since no code change is being made; happy to add one if desired.

Copilot AI changed the title [WIP] Fix stale local state during edit transitions Confirm edit-state cleanup bug already fixed; no code changes Jun 3, 2026
Copilot AI requested a review from CarlosNZ June 3, 2026 13:28
Base automatically changed from feat/v2.0-api-standardisation to v2.0-dev June 3, 2026 21:15
@CarlosNZ CarlosNZ marked this pull request as ready for review June 3, 2026 21:45
@CarlosNZ CarlosNZ closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit-state cleanup: stale local state when transitioning edits via non-EditButtons paths

2 participants