Skip to content

fix (rrdom): Fix edge case where oldChild can become detach causing the recursive function to end early #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

arivyiii
Copy link

@arivyiii arivyiii commented Jul 22, 2025

Fix an edge case in diffChildren: when we replace an old child via oldTree.parentNode?.replaceChild(calibratedOldTree, oldTree); its nextSibling pointer is lost, causing the diff loop to exit early and inadvertently remove subsequent elements and styles.

Copy link

changeset-bot bot commented Jul 22, 2025

🦋 Changeset detected

Latest commit: f428458

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
rrdom Patch
rrweb Patch
rrweb-snapshot Patch
rrdom-nodejs Patch
rrweb-player Patch
@rrweb/all Patch
@rrweb/replay Patch
@rrweb/record Patch
@rrweb/types Patch
@rrweb/packer Patch
@rrweb/utils Patch
@rrweb/web-extension Patch
rrvideo Patch
@rrweb/rrweb-plugin-console-record Patch
@rrweb/rrweb-plugin-console-replay Patch
@rrweb/rrweb-plugin-sequential-id-record Patch
@rrweb/rrweb-plugin-sequential-id-replay Patch
@rrweb/rrweb-plugin-canvas-webrtc-record Patch
@rrweb/rrweb-plugin-canvas-webrtc-replay Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

const newNode = createOrGetNode(newChild, replayer.mirror, rrnodeMirror);

try {
handleInsertBefore(oldTree, newNode, oldChild);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be a silly question... where is handleInsertBefore defined?
i don't find it in rrweb at all

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maybe this PR is incomplete? @arivyiii is that a mispelling or something that was left out?

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.

3 participants