Skip to content

fix: clamp timeline drag selection to 1s minimum#593

Open
sshane wants to merge 1 commit into
masterfrom
clamp-min-section-1s
Open

fix: clamp timeline drag selection to 1s minimum#593
sshane wants to merge 1 commit into
masterfrom
clamp-min-section-1s

Conversation

@sshane
Copy link
Copy Markdown
Contributor

@sshane sshane commented Apr 30, 2026

Summary

Sub-second drag selections produced inconsistent state — zoom/loop held millisecond-precision bounds while the URL collapsed (`Math.floor(start/1000) === Math.floor(end/1000)`) and dropped the range. Reload would lose the section even though Redux still had it.

Round the drag's start/end to whole seconds (matching URL precision) and ensure end > start, so any drag becomes at least a 1-second section. No separate ms-precision internal state to keep in sync with the URL.

Test plan

  • Tiny drag (under a second) → resulting section is exactly 1s wide and reflected in the URL
  • Normal drag (e.g. 5s span) → unchanged, still rounds to whole seconds
  • Drag at second 0 → still creates a section (unrelated, but worth eyeballing alongside fix: timeline selections starting at offset 0 #592)
  • `pnpm lint` clean
  • `pnpm test` passes (30/30)

🤖 Generated with Claude Code

Sub-second drag selections produced inconsistent state: zoom/loop
held millisecond-precision bounds while the URL collapsed
\`Math.floor(start/1000) === Math.floor(end/1000)\` and dropped the
range entirely.

Round drag offsets to whole seconds (URL precision) at dispatch time
and ensure end > start, so any drag becomes at least a 1-second
section. No separate ms-precision internal state to keep in sync.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Welcome to connect! Make sure to:

  • read the contributing guidelines
  • mark your PR as a draft until it's ready to review
  • post the preview on Discord; feedback from users will speedup the PR review

deployed preview: https://593.connect-d5y.pages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant