You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(replay): Fix re-sampled sessions after a click
This fixes a bug where an expired session-based replay will always force a new session-based replay after a click, regardless of the actual recording mode.
What is happening is:
- a session-based replay is left idle
- user comes back and clicks on the page and triggers the click listener
- `addBreadcrumbEvent()` is called which then calls `triggerUserActivity()` because it is a click
- next, `_checkSession()` and `_refreshSession()` are called and this is where the problem starts
Inside of `_refreshSession` we stop the current replay (because the session is expired), however `stop()` is async and is `await`-ed before we re-sample. So the current replay state while `stop()` is finishing has:
- `recordingMode` = `session` (initial value)
- `isEnabled` = false
Another however, `addBreadcrumbEvent` (and everything called until `_refreshSession`) are not async and does wait for resampling (`initializeSampling()`) to occur. This means that the click breadcrumb ends up causing a flush and always starting a new replay recording.
0 commit comments