Skip to content

fix(replay): Do not depend on event.type to infer isCheckout #7237

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

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 3 additions & 4 deletions packages/replay/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,17 +534,16 @@ export class ReplayContainer implements ReplayContainerInterface {
// when an error occurs. Clear any state that happens before this current
// checkout. This needs to happen before `addEvent()` which updates state
// dependent on this reset.
if (this.recordingMode === 'error' && event.type === 2) {
if (this.recordingMode === 'error' && isCheckout) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this impact the behavior of start/stop recording in any way? I believe we should have test coverage around it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So right now it will, because we do not always have isCheckout === true on initial snapshots. So we would need to to merge getsentry/rrweb#56 in first to make this work as expected, I think.

this._setInitialState();
}

// We need to clear existing events on a checkout, otherwise they are
// incremental event updates and should be appended
void addEvent(this, event, isCheckout);

// Different behavior for full snapshots (type=2), ignore other event types
// See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16
if (event.type !== 2) {
// Different behavior for checkouts, ignore other event types
if (!isCheckout) {
return false;
}

Expand Down