From cacf4b7703dbb28c18781611d514305fe6fa401f Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Tue, 29 Jul 2025 18:18:25 -0400 Subject: [PATCH 1/3] feat(replay/v9): Deprecate `_experiments.autoFlushOnFeedback` This feature works pretty well so we are going to make this the default behavior and deprecate the settings. We should remove this in v10. --- .../suites/replay/autoFlushOnFeedback/init.js | 3 --- packages/replay-internal/src/replay.ts | 2 +- packages/replay-internal/src/types/replay.ts | 3 +++ .../src/util/addGlobalListeners.ts | 15 +++++---------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/replay/autoFlushOnFeedback/init.js b/dev-packages/browser-integration-tests/suites/replay/autoFlushOnFeedback/init.js index ecbfac30016e..7b73a029761d 100644 --- a/dev-packages/browser-integration-tests/suites/replay/autoFlushOnFeedback/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/autoFlushOnFeedback/init.js @@ -5,9 +5,6 @@ window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, useCompression: false, - _experiments: { - autoFlushOnFeedback: true, - }, }); Sentry.init({ diff --git a/packages/replay-internal/src/replay.ts b/packages/replay-internal/src/replay.ts index 8bfebcbda173..ae3aa9589cab 100644 --- a/packages/replay-internal/src/replay.ts +++ b/packages/replay-internal/src/replay.ts @@ -939,7 +939,7 @@ export class ReplayContainer implements ReplayContainerInterface { // There is no way to remove these listeners, so ensure they are only added once if (!this._hasInitializedCoreListeners) { - addGlobalListeners(this, { autoFlushOnFeedback: this._options._experiments.autoFlushOnFeedback }); + addGlobalListeners(this); this._hasInitializedCoreListeners = true; } diff --git a/packages/replay-internal/src/types/replay.ts b/packages/replay-internal/src/types/replay.ts index 68ee0d749067..98f61da231c6 100644 --- a/packages/replay-internal/src/types/replay.ts +++ b/packages/replay-internal/src/types/replay.ts @@ -235,6 +235,9 @@ export interface ReplayPluginOptions extends ReplayNetworkOptions { * https://github.com/rrweb-io/rrweb/blob/master/docs/recipes/cross-origin-iframes.md#considerations */ recordCrossOriginIframes: boolean; + /** + * @deprecated This option is now the default behavior and the option is no longer needed. It will be removed in the next major version. + */ autoFlushOnFeedback: boolean; /** * Completetly ignore mutations matching the given selectors. diff --git a/packages/replay-internal/src/util/addGlobalListeners.ts b/packages/replay-internal/src/util/addGlobalListeners.ts index 530749c6e3f7..cd5c141d0160 100644 --- a/packages/replay-internal/src/util/addGlobalListeners.ts +++ b/packages/replay-internal/src/util/addGlobalListeners.ts @@ -16,10 +16,7 @@ import type { ReplayContainer } from '../types'; /** * Add global listeners that cannot be removed. */ -export function addGlobalListeners( - replay: ReplayContainer, - { autoFlushOnFeedback }: { autoFlushOnFeedback?: boolean }, -): void { +export function addGlobalListeners(replay: ReplayContainer): void { // Listeners from core SDK // const client = getClient(); @@ -64,17 +61,15 @@ export function addGlobalListeners( const replayId = replay.getSessionId(); if (options?.includeReplay && replay.isEnabled() && replayId && feedbackEvent.contexts?.feedback) { // In case the feedback is sent via API and not through our widget, we want to flush replay - if (feedbackEvent.contexts.feedback.source === 'api' && autoFlushOnFeedback) { + if (feedbackEvent.contexts.feedback.source === 'api') { await replay.flush(); } feedbackEvent.contexts.feedback.replay_id = replayId; } }); - if (autoFlushOnFeedback) { - client.on('openFeedbackWidget', async () => { - await replay.flush(); - }); - } + client.on('openFeedbackWidget', async () => { + await replay.flush(); + }); } } From d550f757a3950425e71d39a8b8bd61131ff56a68 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Tue, 29 Jul 2025 18:26:53 -0400 Subject: [PATCH 2/3] remove `_experiments.autoFlushOnFeedback` option --- packages/replay-internal/src/types/replay.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/replay-internal/src/types/replay.ts b/packages/replay-internal/src/types/replay.ts index 98f61da231c6..1e7891a84e76 100644 --- a/packages/replay-internal/src/types/replay.ts +++ b/packages/replay-internal/src/types/replay.ts @@ -236,11 +236,7 @@ export interface ReplayPluginOptions extends ReplayNetworkOptions { */ recordCrossOriginIframes: boolean; /** - * @deprecated This option is now the default behavior and the option is no longer needed. It will be removed in the next major version. - */ - autoFlushOnFeedback: boolean; - /** - * Completetly ignore mutations matching the given selectors. + * Completely ignore mutations matching the given selectors. * This can be used if a specific type of mutation is causing (e.g. performance) problems. * NOTE: This can be dangerous to use, as mutations are applied as incremental patches. * Make sure to verify that the captured replays still work when using this option. From 0da0872bec93013836aad42734c4d71f79b8be9d Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 31 Jul 2025 15:01:21 +0200 Subject: [PATCH 3/3] add migration entry --- MIGRATION.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index bc851a6dd0c7..ceaa6578e8eb 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -61,6 +61,8 @@ Sentry.init({ }); ``` +- (Session Replay) The `_experiments.autoFlushOnFeedback` option was removed and is now default behavior. + ## 3. Behaviour Changes ### Removal of First Input Delay (FID) Web Vital Reporting