fix(timeline): coalesce scrub state updates per frame - #520
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthrough
ChangesTimeline scrubbing
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Timeline scrubbing now batches React timecode updates once per animation frame while preserving immediate playhead movement and latest-position seeking. No actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description is complete and follows the repository template. It explains the change, links issue Full details: Linked Issues checkExplanation The changes satisfy issue
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Root cause
Timeline scrubbing already had two performance protections: direct DOM movement for the playhead and an animation-frame-coalesced store/native seek.
setScrubbingTimeSec, however, sat between them and ran on everypointermove, forcing the timeline subtree to re-render at raw pointer frequency.Pointer-down remains immediate. During a drag, local scrub state and the store/native seek now publish together once per animation frame, while the direct playhead write preserves zero-latency visual tracking.
Related issue
Fixes #407
Type of change
Release impact
Desktop impact
Screenshots / video
No visual change. The timecode still follows the latest pointer position each rendered frame.
Testing
npx vitest --run src/components/ai-edition/v4/V4Timeline.geometry.test.tsx src/components/ai-edition/v4/V4Timeline.waveform.test.tsx— 17 passednpx tsc --noEmitnpx tsc -p tsconfig.test.json --noEmitnpm run lint— no errors (14 pre-existing warnings)npm run test— 181 files, 2,164 passed, 2 skippedgit diff --checkSummary by CodeRabbit
Bug Fixes
Tests