diff --git a/src/snapshot.ts b/src/snapshot.ts index c6249eb..c25ce1c 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -652,6 +652,7 @@ export function serializeNodeWithId( onSerialize?: (n: INode) => unknown; onIframeLoad?: (iframeINode: INode, node: serializedNodeWithId) => unknown; iframeLoadTimeout?: number; + isFullSnapshot?: boolean; }, ): serializedNodeWithId | null { const { @@ -670,6 +671,7 @@ export function serializeNodeWithId( onSerialize, onIframeLoad, iframeLoadTimeout = 5000, + isFullSnapshot = false, } = options; let { preserveWhiteSpace = true } = options; const _serializedNode = serializeNode(n, { @@ -691,7 +693,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) || @@ -749,6 +751,7 @@ export function serializeNodeWithId( onSerialize, onIframeLoad, iframeLoadTimeout, + isFullSnapshot, }; for (const childN of Array.from(n.childNodes)) { const serializedChildNode = serializeNodeWithId(childN, bypassOptions); @@ -908,6 +911,7 @@ function snapshot( onSerialize, onIframeLoad, iframeLoadTimeout, + isFullSnapshot: true, }), idNodeMap, ];