Skip to content

Commit e5afddd

Browse files
committed
PR feedback
1 parent cde997f commit e5afddd

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ window.Replay = new Sentry.Replay({
55
flushMinDelay: 200,
66
flushMaxDelay: 200,
77
_experiments: {
8-
fullSnapshotOnMutationsOver: 250,
8+
mutationLimit: 250,
99
},
1010
});
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { sentryTest } from '../../../../utils/fixtures';
44
import { getReplayRecordingContent, shouldSkipReplayTest, waitForReplayRequest } from '../../../../utils/replayHelpers';
55

66
sentryTest(
7-
'handles large mutations with _experiments.fullSnapshotOnMutationsOver configured',
7+
'handles large mutations with _experiments.mutationLimit configured',
88
async ({ getLocalTestPath, page, forceFlushReplay }) => {
99
if (shouldSkipReplayTest()) {
1010
sentryTest.skip();

packages/replay/src/replay.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,11 +828,13 @@ export class ReplayContainer implements ReplayContainerInterface {
828828
private _onMutationHandler = (mutations: unknown[]): boolean => {
829829
const count = mutations.length;
830830

831-
const fullSnapshotOnMutationsOver = this._options._experiments.fullSnapshotOnMutationsOver || 0;
831+
const mutationLimit = this._options._experiments.mutationLimit || 0;
832+
const mutationBreadcrumbLimit = this._options._experiments.mutationBreadcrumbLimit || 1000;
833+
const overMutationLimit = mutationLimit && count > mutationLimit;
832834

833835
// Create a breadcrumb if a lot of mutations happen at the same time
834836
// We can show this in the UI as an information with potential performance improvements
835-
if (count > 500 || (fullSnapshotOnMutationsOver && count > fullSnapshotOnMutationsOver)) {
837+
if (count > mutationBreadcrumbLimit || overMutationLimit) {
836838
const breadcrumb = createBreadcrumb({
837839
category: 'replay.mutations',
838840
data: {
@@ -842,7 +844,7 @@ export class ReplayContainer implements ReplayContainerInterface {
842844
this._createCustomBreadcrumb(breadcrumb);
843845
}
844846

845-
if (fullSnapshotOnMutationsOver && count > fullSnapshotOnMutationsOver) {
847+
if (overMutationLimit) {
846848
// We want to skip doing an incremental snapshot if there are too many mutations
847849
// Instead, we do a full snapshot
848850
this._triggerFullSnapshot(false);

packages/replay/src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ export interface ReplayPluginOptions extends SessionOptions {
110110
_experiments: Partial<{
111111
captureExceptions: boolean;
112112
traceInternals: boolean;
113-
fullSnapshotOnMutationsOver: number;
113+
mutationLimit: number;
114+
mutationBreadcrumbLimit: number;
114115
}>;
115116
}
116117

0 commit comments

Comments
 (0)