Skip to content

Root rollback loses keyed rows after an @empty refill in one drain #984

Closed

Description

@domgan-oai

Reproduction

A keyed @for has borrowed-marker @empty content and starts with [a,b,c]. A root-level sibling uses use(load(susp)) and holds the committed root when susp=1 is pending. In one act, make an urgent parent update clear the list, then a startTransition refill it and suspend the sibling:

await act(() => {
  api.setStep(1); // [a,b,c] -> []: rows are parked while still connected
  startTransition(() => {
    api.setLocal(1); // [] -> [d]: the @empty block is parked
    api.setSusp(1); // root-level use() stays pending
  });
});

The @empty block's borrowed markers span the list's shared range. When that block is parked, its saved node array includes the previously parked, still-connected rows. Rollback restores a/b/c from their row entries, then flushParkedItems unmounts the transient @empty block and removes those same rows a second time. While the root is held, the list is [], although its committed rows should remain visible and connected. A later keyed insertion can then fail because the row chain and DOM disagree.

Expected regression coverage: public .tsrx fixture with keyed rows (including a multi-node row), @empty, and the sibling root suspender; assert a/b/c order, exact node identity, connected cleanup behavior, no @empty/d after the hold, and a subsequent insertion before b. Exercise the normal and nested rollback windows and the large-list clear path.

This failure reproduces on both main and the earlier PR #982 head, as observed in the review of #982. It is separate from that PR's newly introduced lazy parked-row regression, fixed there by retaining exact node ranges. Its repair needs owned content for the borrowed empty block to avoid overlapping retained row ranges across rollback windows.

Activity

  1. domgan-oai commented on Sep 7, 2026

    @domgan-oai
    ContributorAuthor

    Merged PR #986 fixed this issue at d5de04f. The deterministic public .tsrx reproduction queues setLocal(1) from the @empty body during the urgent clear; the refilled list then queues the sibling setSusp(1) in the same root render drain. Before the fix, the held a/b/c rows disappeared and a later keyed insertion threw NotFoundError. The direct two-setter startTransition sketch in the issue body can take a different snapshot and does not consistently trigger that failure.

    The fix also checks a 1,000-row owned-list clear and the nested Suspense case where an inner rollback must leave outer-retired rows connected through cleanup. Source-only baseline/candidate probes passed, and PR current-head CI passed all relevant checks on 71b8e29f. This issue closed with the merge.

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