diff --git a/.changeset/eight-terms-hunt.md b/.changeset/eight-terms-hunt.md new file mode 100644 index 0000000000..f5dc1d0eb9 --- /dev/null +++ b/.changeset/eight-terms-hunt.md @@ -0,0 +1,5 @@ +--- +'rrweb': patch +--- + +Fix: Switch from virtual dom to real dom before rebuilding fullsnapshot diff --git a/packages/rrweb/src/replay/index.ts b/packages/rrweb/src/replay/index.ts index a6591142c0..52762102ff 100644 --- a/packages/rrweb/src/replay/index.ts +++ b/packages/rrweb/src/replay/index.ts @@ -777,6 +777,16 @@ export class Replayer { } }; + /** + * Normally rebuilding full snapshot should not be under virtual dom environment. + * But if the order of data events has some issues, it might be possible. + * Adding this check to avoid any potential issues. + */ + if (this.usingVirtualDom) { + this.virtualDom.destroyTree(); + this.usingVirtualDom = false; + } + this.mirror.reset(); rebuild(event.data.node, { doc: this.iframe.contentDocument,