Skip to content

Test: reproduce unnecessary remount of a retained nested child - #213

Merged
raquo merged 3 commits into
raquo:masterfrom
nguyenyou:codex/nested-child-retention-reproducer
Sep 24, 2026
Merged

raquo merged 3 commits into
raquo:masterfrom
nguyenyou:codex/nested-child-retention-reproducer

Conversation

@nguyenyou

Copy link
Copy Markdown
Contributor

Adds a reproducer for an onMountInsert takeover from children <-- containing a and nested child <-- Val(b) to child <-- b.

Current behavior:
The takeover unmounts a, unmounts b, then mounts b again.

Expected behavior:
Only a should unmount. The same b is already mounted under the same DOM parent and should be retained, matching the existing non-nested takeover test and the cleanup helper’s retention contract.

Tests only; no implementation changes. Against master, the existing 13 takeover tests pass and the new reproducer fails.

Run:
sbt 'testOnly *InserterTakeoverSpec'

Add a takeover reproducer that retains the same child previously rendered through a nested inserter.

Co-Authored-By: Codex GPT-6 Astra <codex@openai.com>
@nguyenyou
nguyenyou requested a review from raquo as a code owner September 23, 2026 07:23
@raquo raquo self-assigned this Sep 23, 2026
…s minimizeDiff option. #213

This eliminates unnecessary re-mounts in more complicated cases.
@raquo

raquo commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Thanks, I've extended keepNode logic to support seamless moves in more complicated cases involving inserter nesting.

As part of this I've also added a new minimizeDiff param to ReplaceAll command – if true, it will avoid unnecessary re-mounts. In case of ReplaceAll, this has non-trivial cost, and children.command is intended for performance critical applications, so it's up to the user to choose what they want for their use case – as explained in scaladoc.

@raquo
raquo merged commit ff42b02 into raquo:master Sep 24, 2026
raquo added a commit that referenced this pull request Sep 24, 2026
…s minimizeDiff option. #213

This eliminates unnecessary re-mounts in more complicated cases.
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