From af57732473554cc81f61721953585d5c62086e12 Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Thu, 16 Feb 2023 16:00:16 +1100 Subject: [PATCH] Fix: Switch to real dom before rebuilding fullsnapshot --- .changeset/eight-terms-hunt.md | 5 +++++ packages/rrweb/src/replay/index.ts | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .changeset/eight-terms-hunt.md 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,