fix(replay): detect session rotation while _isIdle is unknown#3511
Open
fix(replay): detect session rotation while _isIdle is unknown#3511
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts:1514
**Missing changeset for `packages/browser`**
This fix modifies `packages/browser/` but no changeset file was generated. Per the repository convention, a `pnpm changeset` output using `posthog-js` is required for changes in this package. The PR checklist also has this item unchecked.
Reviews (1): Last reviewed commit: "fix(replay): detect session rotation whi..." | Re-trigger Greptile |
Contributor
Contributor
|
Size Change: +16 B (0%) Total Size: 7.08 MB
ℹ️ View Unchanged
|
ksvat
approved these changes
May 1, 2026
Contributor
ksvat
left a comment
There was a problem hiding this comment.
make sure to run a changeset
also truthiness strikes again RIPPPPP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a session rotates before any rrweb-interactive event fires, the recorder misses the rotation. The new session's initial Meta + FullSnapshot end up written to the prior session's blob, leaving the new session with orphan incrementals and no renderable base frame, the player sits on "Buffering..." until the next periodic snapshot (~5 minutes later).
_updateWindowAndSessionIdsbailed early on truthy_isIdle, which catches bothtrue(confirmed idle) and the initial'unknown'state. Sessions whose_isIdlenever flips from'unknown'tofalse(no rrweb-interactive event yet) silently miss session-change detection.Changes
Change the predicate from
if (this._isIdle)toif (this._isIdle === true). This mirrors the existing=== truepredicate inonRRwebEmit, whose comment already calls out: "we don't want to return early if idle is 'unknown'". The confirmed-idle path is unchanged, the'unknown'state now correctly proceeds to the session-change check.Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changesetto generate a changeset file