Skip to content

[bug] batchSetNodes clobbers a focused/pending node on tree (re)load — missing the skip-while-editing guard #1436

Closed

Description

@mstomar125

Severity: high · Confidence: med-high (verified guard is absent)

setNode() refuses to overwrite a focused or pending node from a database source (shared-node-store.svelte.ts:1409-1440), but batchSetNodes() (1692-1760, used by doLoadChildrenTree with a database source, line 2178) only replicates the ai-chat "fewer messages" guard — no isFocused || hasPending check; it calls nodesSet unconditionally. A concurrent loadChildrenTree for a parent whose child is being edited overwrites the child's optimistic content mid-keystroke (the nodespace-sync#76 corruption class the single-node guard was built to prevent).

Fix: apply the same isFocused || hasPending skip (+ version stash) per node inside the batchSetNodes database-source loop.


Found via the 2026-06-18 multi-repo bug-hunt sweep. Confidence/severity from the sweep + spot-verification.

Activity

  1. mstomar125 commented on Jun 24, 2026

    @mstomar125
    ContributorAuthor

    Resolved in #1453 (Batch A). batchSetNodes now applies the same isFocused || hasPending skip-while-editing guard (+ server-confirmed-version stash) as setNode in its database-source loop, so a concurrent doLoadChildrenTree reload can't clobber a child being edited mid-keystroke. Four new guard cases added to the skip-while-editing suite; full frontend suite 3890/3890; test:free-users 7/7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions