fix(replay): hide duration while chunks are progressively loading#297
Open
ayushjhanwar-png wants to merge 1 commit into
Open
fix(replay): hide duration while chunks are progressively loading#297ayushjhanwar-png wants to merge 1 commit into
ayushjhanwar-png wants to merge 1 commit into
Conversation
… loaded The player initializes with the first batch of chunks and then ReplayChunkLoader recursively fetches the rest, calling addEvent() + refreshDuration() after each. This causes the displayed duration to visibly grow (e.g. 2:57 → 5:30 → 14:58) as more chunks arrive, which looks like a bug to users. Tracks chunksLoaded in ReplayContext; ReplayChunkLoader flips it true when recursion finishes. If the first batch already contains the whole session (hasMore=false), a small ReplayChunksLoadedFlag component sets it immediately so the UI never sits in a loading state for short sessions. The duration in ReplayTime renders as "…" until everything is in, then switches to the final value in one step.
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 opening a session replay, the duration display jumps around as chunks load progressively:
The growing duration looks like a bug — users assume the recording is shorter than it is and try to scrub, only to have the timeline expand under them. Reported during 30% rollout monitoring.
Root cause
`ReplayPlayer` initializes with the first 50-chunk batch and shows `getMetaData().totalTime` from that subset. `ReplayChunkLoader` then recursively fetches remaining batches in the background, calls `addEvent()` for each event, and triggers `refreshDuration()` after each batch. `refreshDuration()` re-reads `getMetaData().totalTime` and updates state — so the displayed duration visibly climbs as more events arrive.
Fix
Track a `chunksLoaded: boolean` in `ReplayContext`:
The duration is still computed and refreshed the same way underneath; we just hide the in-progress value from the user.
Files
Test plan