Skip to content

Commit eda7e33

Browse files
billyvgchargome
andauthored
feat(replay): Promote _experiments.autoFlushOnFeedback option as default (#17220)
Flushing on feedback widget opening is better than on submit as you get more relevant replay context, so we are going to make this the default behavior and remove the configuration option. This is deprecated in #17219 --------- Co-authored-by: Charly Gomez <[email protected]>
1 parent 254a86f commit eda7e33

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

MIGRATION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Sentry.init({
6161
});
6262
```
6363

64+
- (Session Replay) The `_experiments.autoFlushOnFeedback` option was removed and is now default behavior.
65+
6466
## 3. Behaviour Changes
6567

6668
### Removal of First Input Delay (FID) Web Vital Reporting

dev-packages/browser-integration-tests/suites/replay/autoFlushOnFeedback/init.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ window.Replay = Sentry.replayIntegration({
55
flushMinDelay: 200,
66
flushMaxDelay: 200,
77
useCompression: false,
8-
_experiments: {
9-
autoFlushOnFeedback: true,
10-
},
118
});
129

1310
Sentry.init({

packages/replay-internal/src/replay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ export class ReplayContainer implements ReplayContainerInterface {
939939

940940
// There is no way to remove these listeners, so ensure they are only added once
941941
if (!this._hasInitializedCoreListeners) {
942-
addGlobalListeners(this, { autoFlushOnFeedback: this._options._experiments.autoFlushOnFeedback });
942+
addGlobalListeners(this);
943943

944944
this._hasInitializedCoreListeners = true;
945945
}

packages/replay-internal/src/types/replay.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@ export interface ReplayPluginOptions extends ReplayNetworkOptions {
235235
* https://github.com/rrweb-io/rrweb/blob/master/docs/recipes/cross-origin-iframes.md#considerations
236236
*/
237237
recordCrossOriginIframes: boolean;
238-
autoFlushOnFeedback: boolean;
239238
/**
240-
* Completetly ignore mutations matching the given selectors.
239+
* Completely ignore mutations matching the given selectors.
241240
* This can be used if a specific type of mutation is causing (e.g. performance) problems.
242241
* NOTE: This can be dangerous to use, as mutations are applied as incremental patches.
243242
* Make sure to verify that the captured replays still work when using this option.

packages/replay-internal/src/util/addGlobalListeners.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ import type { ReplayContainer } from '../types';
1616
/**
1717
* Add global listeners that cannot be removed.
1818
*/
19-
export function addGlobalListeners(
20-
replay: ReplayContainer,
21-
{ autoFlushOnFeedback }: { autoFlushOnFeedback?: boolean },
22-
): void {
19+
export function addGlobalListeners(replay: ReplayContainer): void {
2320
// Listeners from core SDK //
2421
const client = getClient();
2522

@@ -64,17 +61,15 @@ export function addGlobalListeners(
6461
const replayId = replay.getSessionId();
6562
if (options?.includeReplay && replay.isEnabled() && replayId && feedbackEvent.contexts?.feedback) {
6663
// In case the feedback is sent via API and not through our widget, we want to flush replay
67-
if (feedbackEvent.contexts.feedback.source === 'api' && autoFlushOnFeedback) {
64+
if (feedbackEvent.contexts.feedback.source === 'api') {
6865
await replay.flush();
6966
}
7067
feedbackEvent.contexts.feedback.replay_id = replayId;
7168
}
7269
});
7370

74-
if (autoFlushOnFeedback) {
75-
client.on('openFeedbackWidget', async () => {
76-
await replay.flush();
77-
});
78-
}
71+
client.on('openFeedbackWidget', async () => {
72+
await replay.flush();
73+
});
7974
}
8075
}

0 commit comments

Comments
 (0)