Don't rebuildFullSnapshot if it's the first run (#532)

* Don't rebuildFullSnapshot if it's the first run

* Fix typo
This commit is contained in:
John Pham
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 3e8cacbb95
commit a295f72ed0

View File

@@ -119,7 +119,10 @@ export class Replayer {
private elementStateMap!: Map<INode, ElementState>;
private imageMap: Map<eventWithTime, HTMLImageElement> = new Map();
/** The first time the player is playing. */
private firstPlay = true;
private newDocumentQueue: addedNodeMutation[] = [];
constructor(
@@ -459,6 +462,11 @@ export class Replayer {
break;
case EventType.FullSnapshot:
castFn = () => {
// Don't build a full snapshot during the first play through since we've already built it when the player was mounted.
if (this.firstPlay) {
this.firstPlay = false;
return;
}
this.rebuildFullSnapshot(event, isSync);
this.iframe.contentWindow!.scrollTo(event.data.initialOffset);
};