Skip to content

Conversation

@billyvg
Copy link
Member

@billyvg billyvg commented Nov 13, 2024

When generating page HTML using replay data, we step through the entire replay as quickly as possible and take a snapshot of the DOM at specific timestamps. This was causing issues with media elements as the replayer will try to play them. Skip these frames as these interactions are not important when trying to extract page html.

Fixes JAVASCRIPT-2NXM

When generating page HTML using replay data, we step through the entire replay as quickly as possible and take a snapshot of the DOM at specific timestamps. This was causing issues with media elements as the replayer will try to play them. Skip these frames as these interactions are not important when trying to extract page html.

Fixes JAVASCRIPT-2NXM
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 13, 2024
Comment on lines 496 to 502
getRRWebFramesWithoutMediaInteractions = () =>
this._sortedRRWebEvents.filter(
({type, data}) =>
type === EventType.IncrementalSnapshot &&
data.source !== IncrementalSource.MediaInteraction
);

Copy link
Member Author

Choose a reason for hiding this comment

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

I might actually filter this in replayStepper instead since it's pretty specific to the stepper than consumers of the reader.

@billyvg billyvg marked this pull request as ready for review November 13, 2024 19:48
@billyvg billyvg requested a review from a team as a code owner November 13, 2024 19:48
@billyvg billyvg merged commit 37f9785 into master Nov 13, 2024
42 of 43 checks passed
@billyvg billyvg deleted the fix-replay-ignore-media-interaction-frames-for-replay-stepper branch November 13, 2024 20:46
billyvg added a commit that referenced this pull request Nov 13, 2024
... and elements that do not disappear. Fixes regression introduced in #80681

The filter statement is incorrect, but beyond that, there is a larger problem in that the replayStepper is somehow affecting the replayer playback instance.
billyvg added a commit that referenced this pull request Nov 13, 2024
... and elements that do not disappear. Fixes regression introduced in
#80681

The filter statement is incorrect, but beyond that, there is a larger
problem in that the replayStepper is somehow affecting the replayer
playback instance.
billyvg added a commit that referenced this pull request Nov 22, 2024
... due to shared object references in `replayStepper`. This happens on
Replay details page where we have the replayer as well as a tab that
uses `replayStepper` (e.g. Breadcrumbs). Both `Replayer` instances were
access the same rrweb event object references and because
`replayStepper` plays through the entire replay as fast as possible, it
ends up mutating the event objects that the player instance later reads.
This ends up causing issues in the playback (like screens not updating
so the replay appears frozen and broken). I don't know exactly what
mutations are happening that cause the playback issues, nor do I know
why it only affects Firefox and not Chrome.

We now deep clone the events in `createHiddenPlayer` to avoid the above
situation.

We first realized this was an issue with `replayStepper` due to
#80681 and [its
fix](#80697). The events in our
hidden replayer were affecting our main playback which indicates that
there was some shared state happening. h/t @ryan953 for the suggestion
re: object mutations!

Closes getsentry/sentry-javascript#14381
Closes getsentry/sentry-javascript#12978
harshithadurai pushed a commit that referenced this pull request Nov 25, 2024
... due to shared object references in `replayStepper`. This happens on
Replay details page where we have the replayer as well as a tab that
uses `replayStepper` (e.g. Breadcrumbs). Both `Replayer` instances were
access the same rrweb event object references and because
`replayStepper` plays through the entire replay as fast as possible, it
ends up mutating the event objects that the player instance later reads.
This ends up causing issues in the playback (like screens not updating
so the replay appears frozen and broken). I don't know exactly what
mutations are happening that cause the playback issues, nor do I know
why it only affects Firefox and not Chrome.

We now deep clone the events in `createHiddenPlayer` to avoid the above
situation.

We first realized this was an issue with `replayStepper` due to
#80681 and [its
fix](#80697). The events in our
hidden replayer were affecting our main playback which indicates that
there was some shared state happening. h/t @ryan953 for the suggestion
re: object mutations!

Closes getsentry/sentry-javascript#14381
Closes getsentry/sentry-javascript#12978
evanh pushed a commit that referenced this pull request Nov 25, 2024
... due to shared object references in `replayStepper`. This happens on
Replay details page where we have the replayer as well as a tab that
uses `replayStepper` (e.g. Breadcrumbs). Both `Replayer` instances were
access the same rrweb event object references and because
`replayStepper` plays through the entire replay as fast as possible, it
ends up mutating the event objects that the player instance later reads.
This ends up causing issues in the playback (like screens not updating
so the replay appears frozen and broken). I don't know exactly what
mutations are happening that cause the playback issues, nor do I know
why it only affects Firefox and not Chrome.

We now deep clone the events in `createHiddenPlayer` to avoid the above
situation.

We first realized this was an issue with `replayStepper` due to
#80681 and [its
fix](#80697). The events in our
hidden replayer were affecting our main playback which indicates that
there was some shared state happening. h/t @ryan953 for the suggestion
re: object mutations!

Closes getsentry/sentry-javascript#14381
Closes getsentry/sentry-javascript#12978
@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants