Skip to content

Commit

Permalink
Bump (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
John Pham authored Apr 8, 2021
1 parent 2ea59be commit 685d96d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 8 additions & 4 deletions src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export class Replayer {
private elementStateMap!: Map<INode, ElementState>;

private imageMap: Map<eventWithTime, HTMLImageElement> = new Map();
/** The first time the player is playing. */
private firstPlay = false;

constructor(
events: Array<eventWithTime | string>,
Expand Down Expand Up @@ -238,7 +240,6 @@ export class Replayer {
}, 0);
}
if (firstFullsnapshot) {
(firstFullsnapshot as fullSnapshotEvent).isFirstFullSnapshot = true;
setTimeout(() => {
this.rebuildFullSnapshot(
firstFullsnapshot as fullSnapshotEvent & { timestamp: number },
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export type fullSnapshotEvent = {
left: number;
};
};
isFirstFullSnapshot?: boolean;
};

export type incrementalSnapshotEvent = {
Expand Down

0 comments on commit 685d96d

Please sign in to comment.