Skip to content

Commit df319e4

Browse files
committed
feat(replay/v9): Add option to skip requestAnimationFrame for canvas snapshots
This adds an option to `snapshot()` to skip `requestAnimationFrame` when manually snapshotting.
1 parent b57c43e commit df319e4

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

packages/replay-canvas/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
},
6868
"homepage": "https://docs.sentry.io/platforms/javascript/session-replay/",
6969
"devDependencies": {
70-
"@sentry-internal/rrweb": "2.35.0"
70+
"@sentry-internal/rrweb": "2.37.0"
7171
},
7272
"dependencies": {
7373
"@sentry-internal/replay": "9.46.0",

packages/replay-canvas/src/canvas.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ import { defineIntegration } from '@sentry/core';
33
import type { CanvasManagerInterface, CanvasManagerOptions } from '@sentry-internal/replay';
44
import { CanvasManager } from '@sentry-internal/rrweb';
55

6+
interface SnapshotOptions {
7+
skipRequestAnimationFrame?: boolean;
8+
}
9+
610
interface ReplayCanvasIntegration extends Integration {
7-
snapshot: (canvasElement?: HTMLCanvasElement) => Promise<void>;
11+
snapshot: (canvasElement?: HTMLCanvasElement, options?: SnapshotOptions) => Promise<void>;
812
}
913

1014
interface ReplayCanvasOptions {
@@ -106,9 +110,10 @@ export const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions>
106110
...(CANVAS_QUALITY[quality || 'medium'] || CANVAS_QUALITY.medium),
107111
};
108112
},
109-
async snapshot(canvasElement?: HTMLCanvasElement) {
113+
async snapshot(canvasElement?: HTMLCanvasElement, options?: SnapshotOptions) {
110114
const canvasManager = await _canvasManager;
111-
canvasManager.snapshot(canvasElement);
115+
116+
canvasManager.snapshot(canvasElement, options);
112117
},
113118
};
114119
}) satisfies IntegrationFn<ReplayCanvasIntegration>;

packages/replay-internal/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
"devDependencies": {
8484
"@babel/core": "^7.27.7",
8585
"@sentry-internal/replay-worker": "9.46.0",
86-
"@sentry-internal/rrweb": "2.35.0",
87-
"@sentry-internal/rrweb-snapshot": "2.35.0",
86+
"@sentry-internal/rrweb": "2.37.0",
87+
"@sentry-internal/rrweb-snapshot": "2.37.0",
8888
"fflate": "0.8.2",
8989
"jest-matcher-utils": "^29.0.0",
9090
"jsdom-worker": "^0.3.0",

0 commit comments

Comments
 (0)