Commit ca9c416
committed
fix(timeline): move getPlaybackTimeMs ref sync out of render phase
Per CodeRabbit review on #120: PlaybackCursor wrote to
getPlaybackTimeMsRef.current directly in the render body instead of in an
effect. Writing to a ref during render is a React anti-pattern — it can leave
the ref holding a stale value from a discarded render pass under concurrent
rendering. Moved the assignment into a useEffect keyed on getPlaybackTimeMs,
matching the recommended pattern for "latest callback" refs.
Verified: tsc --noEmit clean, biome clean, rafCoalescer.test.ts and
zoomRegionUtils.test.ts pass (7/7).1 parent 27695b9 commit ca9c416
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
320 | 322 | | |
321 | 323 | | |
322 | 324 | | |
| |||
0 commit comments