Skip to content

feat(replay)!: Promote _experiments.autoFlushOnFeedback option as default #17220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ window.Replay = Sentry.replayIntegration({
flushMinDelay: 200,
flushMaxDelay: 200,
useCompression: false,
_experiments: {
autoFlushOnFeedback: true,
},
});

Sentry.init({
Expand Down
2 changes: 1 addition & 1 deletion packages/replay-internal/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/replay-internal/src/types/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,8 @@ export interface ReplayPluginOptions extends ReplayNetworkOptions {
* https://github.com/rrweb-io/rrweb/blob/master/docs/recipes/cross-origin-iframes.md#considerations
*/
recordCrossOriginIframes: boolean;
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.
Expand Down
15 changes: 5 additions & 10 deletions packages/replay-internal/src/util/addGlobalListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
});
}
}
Loading