Skip to content

Test: reproduce stale content mounting after moving a dynamic group - #220

Open
nguyenyou wants to merge 4 commits into
raquo:masterfrom
nguyenyou:claude/nested-group-activation-order
Open

nguyenyou wants to merge 4 commits into
raquo:masterfrom
nguyenyou:claude/nested-group-activation-order

Conversation

@nguyenyou

Copy link
Copy Markdown
Contributor

Recreates the original PR #210, which was automatically closed when my fork was accidentally deleted.

Adds regression tests for NestedGroup.moveToParent.

A child <-- inserter retains its DOM content while unmounted and must reconcile to the latest value on remount. The old node must not receive a mount callback after it has been superseded.

Current behavior mounts the stale node first, then creates and mounts the new node.

Expected behavior is to unmount the old node, create the new node, and mount only the new node.

The stale mount can cause permanent damage

Mounting stale content also runs its own bindings. In the second set of tests, the stale element has a child.maybe <-- that claims an element e living in an unrelated live list:

  1. After the move, the stale element mounts and its binding steals e from that list.
  2. The group then re-renders and drops the stale element, and e leaves the page with it.

e is never restored. The actual events are [mount:c, unmount:c, unmount:e], where nothing should happen.

The same scenario without a move (the REFERENCE tests) leaves e untouched.

This fails on all three move paths:

  • stolen from an unmounted host into a mounted list;
  • moved onto a mounted element;
  • moved onto an unmounted element that is then mounted.

It also fails at depth 2, where the stale content is a nested group (actual: [unmount:e]). The recursive move re-registers the inner group too, so a fix must hold at every nesting depth, not just for the outermost group.

Run:

sbt 'testOnly *NestedGroupActivationOrderSpec'

nguyenyou and others added 4 commits September 23, 2026 20:43
Adds regression tests for stale content mounting after a nested group move.

Co-Authored-By: Codex GPT-6 Astra <codex@openai.com>
… group move

When a moved group's stale content mounts ahead of the group's re-render, its own
bindings run too. Here the stale element's `child.maybe <--` steals a node from an
unrelated live list; the group then drops the stale element, taking that node with it
for good. Covers all three move paths, plus depth 2, where the stale content is a
nested group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add two reference tests and three reproducers for same-parent group reclamation after removal and plain placement.

Co-Authored-By: Codex GPT-6 Astra <codex@openai.com>
@nguyenyou
nguyenyou requested a review from raquo as a code owner October 7, 2026 03:01

This branch has not been deployed

No deployments
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.

2 participants