From 02cdde615801ce17bebb4812e1783be64f336ed7 Mon Sep 17 00:00:00 2001 From: John Pham Date: Wed, 7 Apr 2021 18:15:03 -0700 Subject: [PATCH] Bump --- package.json | 2 +- src/replay/index.ts | 12 ++++++++---- src/types.ts | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1822ecf4..edddc527 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@highlight-run/rrweb", - "version": "0.11.0", + "version": "0.11.1", "description": "record and replay the web", "scripts": { "test": "npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.test.ts", diff --git a/src/replay/index.ts b/src/replay/index.ts index a5b90c24..850f411b 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -114,6 +114,8 @@ export class Replayer { private elementStateMap!: Map; private imageMap: Map = new Map(); + /** The first time the player is playing. */ + private firstPlay = false; constructor( events: Array, @@ -238,7 +240,6 @@ export class Replayer { }, 0); } if (firstFullsnapshot) { - (firstFullsnapshot as fullSnapshotEvent).isFirstFullSnapshot = true; setTimeout(() => { this.rebuildFullSnapshot( firstFullsnapshot as fullSnapshotEvent & { timestamp: number }, @@ -545,10 +546,13 @@ export class Replayer { break; case EventType.FullSnapshot: castFn = () => { - if (!event.isFirstFullSnapshot) { - this.rebuildFullSnapshot(event, isSync); - this.iframe.contentWindow!.scrollTo(event.data.initialOffset); + // 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); this.handleInactivity(event.timestamp); }; break; diff --git a/src/types.ts b/src/types.ts index 6f7da278..ef8e2b5a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -43,7 +43,6 @@ export type fullSnapshotEvent = { left: number; }; }; - isFirstFullSnapshot?: boolean; }; export type incrementalSnapshotEvent = {