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:
@@ -119,7 +119,10 @@ export class Replayer {
|
|||||||
private elementStateMap!: Map<INode, ElementState>;
|
private elementStateMap!: Map<INode, ElementState>;
|
||||||
|
|
||||||
private imageMap: Map<eventWithTime, HTMLImageElement> = new Map();
|
private imageMap: Map<eventWithTime, HTMLImageElement> = new Map();
|
||||||
|
|
||||||
|
/** The first time the player is playing. */
|
||||||
|
private firstPlay = true;
|
||||||
|
|
||||||
private newDocumentQueue: addedNodeMutation[] = [];
|
private newDocumentQueue: addedNodeMutation[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -459,6 +462,11 @@ export class Replayer {
|
|||||||
break;
|
break;
|
||||||
case EventType.FullSnapshot:
|
case EventType.FullSnapshot:
|
||||||
castFn = () => {
|
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.rebuildFullSnapshot(event, isSync);
|
||||||
this.iframe.contentWindow!.scrollTo(event.data.initialOffset);
|
this.iframe.contentWindow!.scrollTo(event.data.initialOffset);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user