Skip to content

feat(replay/v9): Deprecate _experiments.autoFlushOnFeedback #17219

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
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: 3 additions & 0 deletions packages/replay-internal/src/types/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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