feat: shouldSkipChildren — leave a node's children to another renderer - #26
Merged
Conversation
A node whose children are owned by an embedded renderer (a live React root) must not have its subtree diffed: the renderer's internal tree keeps node references, so text rewritten behind its back makes later renders bail out against content they never wrote, and a replacement by a different element that inherits (re-parents) those children makes the renderer's own teardown throw removeChild. The new option skips the subtree walk for matching nodes — attributes on the node itself still sync — never donates their children to a replacement, and keeps the settled reconciliation pass from counting the skipped (possibly still-streaming) children as pending work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
aralroca
added a commit
to aralroca/Janux
that referenced
this pull request
Aug 8, 2026
…visories, update the test census - `patchedDependencies` carries brisa-build/diff-dom-streaming#26 (build + types) until 0.6.11 is on npm: the registry's 0.6.10 has neither the behavior the foreign-safe morph relies on (the interop refresh test is racy without it) nor the option in its types (typecheck and the declaration emit both tripped on TS2353). Drop the patch and refresh the lockfile once the release lands. - js-yaml 3.15.1 / 4.3.1 and nanoid 3.3.17 in the lockfile: the three High advisories osv-scan gates on, all in-range patch fixes. - Test census: 11970 → 11992 (the suite grew by the empty-host guard, the skip-children coverage and the config re-read test). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New
shouldSkipChildren?: (node: Node | null) => booleanoption: a node it matches keeps its subtree out of the diff entirely. The node itself still participates (attributes sync as usual), but its children are never updated, moved, pruned — or donated to a replacement element.Why
An embedded renderer (a live React root mounted inside a host element) keeps internal references to its DOM nodes. When the diff walks into such a host:
NotFoundError: removeChild.Callers that own such hosts can now declare them, diff the rest of the page, and refresh the embedded root through their own channel (e.g. serialized props on the host attribute, which still syncs).
Details
index.d.tsand the option's JSDoc.Tests
Three new cases (run across chrome/firefox/safari like the rest of the suite): subtree kept while attributes sync, chunk boundaries inside the skipped subtree, and no child donation on replacement. Full suite: 150/150.
🤖 Generated with Claude Code