feat: add strict minimum duration for replay#2557
Merged
pauldambra merged 9 commits intomainfrom Nov 12, 2025
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
Contributor
|
Size Change: +1.95 kB (+0.04%) Total Size: 4.98 MB
ℹ️ View Unchanged
|
15 tasks
443caf6 to
b95abcf
Compare
c7d93a4 to
6103a88
Compare
6e08687 to
027d310
Compare
8387ea7 to
33bee02
Compare
0ec2b50 to
4d6726f
Compare
d56abf0 to
dbf91dd
Compare
4d6726f to
e3c6e2b
Compare
e3c6e2b to
4b1dde6
Compare
TueHaulund
approved these changes
Nov 12, 2025
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
minimum duration doesn't work well when there's full page refreshes because we only buffer in-memory
so, if you set 12 seconds minimum then navigate after 6 seconds, after 6 more seconds we detect we're 12 seconds into the session and start to emit
if you bounce at this point we capture 6 seconds of the 12 second session, which is technically correct but often confusing
(for an SPA this is rarely a problem)
Changes
folk who set a minimum are saying they don't want short sessions
so, let's wait until we have minDuration seconds data in the buffer before we start emitting
we then store that we hit that point so that if there's a full page refresh we'll carry on emitting after refresh
this means you're more likely to miss part of short sessions, but then that's what min duration means to many people
(fly by that we clear the buffer when we call stop, but we should flush and then clear buffer)
Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changesetto generate a changeset file