-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: safer progressive loading #40768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Size Change: +56 B (0%) Total Size: 3.34 MB ℹ️ View Unchanged
|
|
9041dc4 to
e0bddc7
Compare
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
|
1 similar comment
|
68e2eaa to
6d411c2
Compare
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 modified, 0 deleted:
Triggered by this commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 2 comments
| percentPlayedOfBuffered: [ | ||
| (s) => [s.dataBufferedUntilPlayerTime, s.currentPlayerTime], | ||
| (dataBufferedUntilPlayerTime, currentPlayerTime) => { | ||
| const bufferedSeconds = Math.floor(dataBufferedUntilPlayerTime / 1000) | ||
| const playerSeconds = Math.floor(currentPlayerTime / 1000) | ||
| return playerSeconds / bufferedSeconds | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: division by zero when bufferedSeconds is 0 (early recording start). returns Infinity or NaN, causing line 1577's check to always pass and trigger excessive loading
| percentPlayedOfBuffered: [ | |
| (s) => [s.dataBufferedUntilPlayerTime, s.currentPlayerTime], | |
| (dataBufferedUntilPlayerTime, currentPlayerTime) => { | |
| const bufferedSeconds = Math.floor(dataBufferedUntilPlayerTime / 1000) | |
| const playerSeconds = Math.floor(currentPlayerTime / 1000) | |
| return playerSeconds / bufferedSeconds | |
| }, | |
| percentPlayedOfBuffered: [ | |
| (s) => [s.dataBufferedUntilPlayerTime, s.currentPlayerTime], | |
| (dataBufferedUntilPlayerTime, currentPlayerTime) => { | |
| const bufferedSeconds = Math.floor(dataBufferedUntilPlayerTime / 1000) | |
| const playerSeconds = Math.floor(currentPlayerTime / 1000) | |
| return bufferedSeconds === 0 ? 0 : playerSeconds / bufferedSeconds | |
| }, | |
| ], |
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
Line: 889:895
Comment:
**logic:** division by zero when `bufferedSeconds` is 0 (early recording start). returns `Infinity` or `NaN`, causing line 1577's check to always pass and trigger excessive loading
```suggestion
percentPlayedOfBuffered: [
(s) => [s.dataBufferedUntilPlayerTime, s.currentPlayerTime],
(dataBufferedUntilPlayerTime, currentPlayerTime) => {
const bufferedSeconds = Math.floor(dataBufferedUntilPlayerTime / 1000)
const playerSeconds = Math.floor(currentPlayerTime / 1000)
return bufferedSeconds === 0 ? 0 : playerSeconds / bufferedSeconds
},
],
```
How can I resolve this? If you propose a fix, please make it concise.| if (!cache.snapshotsBySource) { | ||
| return {} | ||
| } | ||
| // TODO: if we change the data without changing the object instance then dependents don't recalculate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: mutating cache.snapshotsBySource without creating new object instance prevents selector recalculation, potentially causing stale UI state
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx
Line: 358:358
Comment:
**logic:** mutating `cache.snapshotsBySource` without creating new object instance prevents selector recalculation, potentially causing stale UI state
How can I resolve this? If you propose a fix, please make it concise.
📸 UI snapshots have been updated4 snapshot changes in total. 0 added, 4 modified, 0 deleted:
Triggered by this commit. |
|
📸 UI snapshots have been updated5 snapshot changes in total. 0 added, 5 modified, 0 deleted:
Triggered by this commit. |
|
|
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
|
|
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
|

had to get this out of my head while #4 is watching TV
there are problems with this
i've wrapped this in a flag so we can turn it off easily!