refactor(packages): move slider throttle from commit to change#1219
refactor(packages): move slider throttle from commit to change#1219
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (7)
Players (3)
Skins (17)
UI Components (22)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (6)
Skins (14)
UI Components (19)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (8)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (10)
📦 @videojs/spf — no changesEntries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
The original `adjustPercent` capture at init is correct — it delegates to `core.adjustPercentForAlignment()` which reads current props on every render. The wrapper was both unnecessary and broken (checked presence once at init, not dynamically). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e07c0f3. Configure here.
| const media = this.#timeState.value; | ||
| if (media) media.seek(this.#core.rawValueFromPercent(percent)); | ||
| }, | ||
| commitThrottle: this.commitThrottle, |
There was a problem hiding this comment.
Duplicated seek handlers in time slider callbacks
Low Severity
The newly added onValueChange callback has an identical body to the existing onValueCommit callback in both the HTML and React time slider implementations. A shared local helper (e.g. const handleSeek = (percent) => { … }) passed to both onValueChange and onValueCommit would eliminate the duplication and reduce the risk of the two callbacks diverging if the seek logic ever changes.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e07c0f3. Configure here.


closes #1134
Summary
Slider throttle now governs
onValueChange(continuous feedback during drag) instead ofonValueCommit(final value on release). ThecommitThrottleprop is renamed tochangeThrottleacross all packages. Thethrottleutility gains aleadingoption so the first drag move fires immediately while subsequent moves are coalesced.Changes
commitThrottletochangeThrottleinSliderOptions,TimeSliderProps,TimeSliderElement,useSlider, andTimeSliderRootonValueChangeduring drag (leading + trailing) instead ofonValueCommitonValueCommitnow fires only on pointer release or stale-drag exit, never during dragpointerup: fire unthrottledonValueChangethenonValueCommitin that orderlostpointercapturefollowspointerup{ leading: true }option tothrottle()in@videojs/utilsfor immediate first invocationonValueChangetomedia.seek()for responsive scrubbingTesting
Updated and expanded test suites in
packages/utils,packages/core/dom,packages/core, andpackages/htmlto cover leading-edge throttle, commit ordering, stale-drag fallback, and double-commit prevention.Note
Medium Risk
Behavior and API changes to slider interaction:
commitThrottleis renamed tochangeThrottleand throttling now affectsonValueChangeduring drag, which can change scrubbing/seek frequency across HTML/React consumers. Also updates core pointer/commit semantics (ordering and lost-capture edge cases), so regressions would show up as incorrect seek/commit timing.Overview
Slider throttling is moved from commit to change. The
commitThrottleoption/prop is renamed tochangeThrottleacross core, HTML, and React time sliders, and throttling now applies toonValueChangeduring drag (leading+trailing) rather than toonValueCommit.createSlider()now ensuresonValueCommitonly fires on pointer release or drag termination (stale-drag /lostpointercapture), fires an unthrottledonValueChangeimmediately beforeonValueCommitonpointerup, and prevents double-commits whenlostpointercapturefollowspointerup. Time slider integrations (HTML element and ReactTimeSliderRoot) now wireonValueChangetomedia.seek()for more responsive scrubbing.The
throttle()utility adds{ leading: true }support (immediate first call + coalesced trailing), and tests are updated/expanded to cover the new throttling and commit semantics.Reviewed by Cursor Bugbot for commit e07c0f3. Bugbot is set up for automated code reviews on this repo. Configure here.