diff --git a/src/snapshot.ts b/src/snapshot.ts index 3d04acc..4950a30 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -465,6 +465,7 @@ export function serializeNodeWithId( slimDOMOptions: SlimDOMOptions; recordCanvas?: boolean; preserveWhiteSpace?: boolean; + isFullSnapshot?: boolean; }, ): serializedNodeWithId | null { const { @@ -477,6 +478,7 @@ export function serializeNodeWithId( maskInputOptions = {}, slimDOMOptions, recordCanvas = false, + isFullSnapshot = false, } = options; let { preserveWhiteSpace = true } = options; const _serializedNode = serializeNode(n, { @@ -495,7 +497,7 @@ export function serializeNodeWithId( let id; // Try to reuse the previous id - if ('__sn' in n) { + if ('__sn' in n && !isFullSnapshot) { id = n.__sn.id; } else if ( slimDOMExcluded(_serializedNode, slimDOMOptions) || @@ -545,6 +547,7 @@ export function serializeNodeWithId( slimDOMOptions, recordCanvas, preserveWhiteSpace, + isFullSnapshot, }); if (serializedChildNode) { serializedNode.childNodes.push(serializedChildNode); @@ -625,6 +628,7 @@ function snapshot( maskInputOptions, slimDOMOptions, recordCanvas, + isFullSnapshot: true, }), idNodeMap, ];