Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: slimDOMOptions-mutation-lost
  • Loading branch information
wfk007 committed Sep 9, 2022
commit 243a80a088c0e254aee636e9c6b0049345d0d4cf
9 changes: 5 additions & 4 deletions packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1014,14 +1014,15 @@ export function serializeNodeWithId(
} else {
id = genId();
}
if (id === IGNORED_NODE) {
return null; // slimDOM
}

const serializedNode = Object.assign(_serializedNode, { id });

// add IGNORED_NODE to mirror to track nextSiblings
mirror.add(n, serializedNode);

if (id === IGNORED_NODE) {
return null; // slimDOM
}

if (onSerialize) {
onSerialize(n);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export default class MutationBuffer {
const getNextId = (n: Node): number | null => {
let ns: Node | null = n;
let nextId: number | null = IGNORED_NODE; // slimDOM: ignored
while (nextId === IGNORED_NODE || nextId === -1) {
while (nextId === IGNORED_NODE) {
ns = ns && ns.nextSibling;
nextId = ns && this.mirror.getId(ns);
}
Expand Down