feat(activity-feed-v2): uncheck timestamp toggle when viewer dismisses range draft - #4841
Conversation
…s range draft When the user clicks the waveform outside an open comment range, the viewer emits comment_range_draft_dismiss. Treat that as toggle-off so the checkbox, pinned range, and draft handles stay in sync. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughChangesAudio draft dismissal
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant AudioRangeViewer
participant useMediaTimestamp
participant TimestampToggle
AudioRangeViewer->>useMediaTimestamp: comment_range_draft_dismiss
useMediaTimestamp->>TimestampToggle: clear pressed state and timestamp range
useMediaTimestamp->>AudioRangeViewer: comment_range_draft_clear
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The timestamp dismissal behavior clears the range and keeps the viewer and composer synchronized, with coverage for the relevant lifecycle and re-enable flows. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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. A rabbit taps the waveform bright Comment |
greg-in-a-box
left a comment
There was a problem hiding this comment.
Review
Looks good — clean wiring for comment_range_draft_dismiss.
Sharing the toggle-off path through uncheckTimestamp keeps click-outside and the checkbox in lockstep (pressed off, pinned range dropped, clear echoed only when the toggle was on). Listener attach/remove matches the existing comment_range_draft_change pattern, and the unit + ActivityFeedV2 coverage hits the important cases (dismiss while on, ignore while off, re-toggle after dismiss).
Nit (non-blocking): the test plan calls out dismiss with the toggle on but no prior drag (collapsed handles). That path is the same code as the dragged case, but a one-liner unit test would lock it in.
Approving.
greg-in-a-box
left a comment
There was a problem hiding this comment.
Review
Looks good — this mirrors manual toggle-off cleanly and keeps the composer/viewer in sync.
What works well
- Extracting
uncheckTimestampso dismiss and toggle-off share one path avoids drift. - Guarding dismiss with
isPressedRefso an off toggle does not emit a spuriouscomment_range_draft_clear. - Listener add/remove for
comment_range_draft_dismissmatches the existing change-listener pattern. - Solid coverage: dismiss-with-range, ignore-when-off, re-press after dismiss, plus the ActivityFeedV2 integration path.
Nit (non-blocking)
- The PR test plan calls out “toggle on, no drag, then click outside.” That path is the same as dismiss-with-range in production (
isPressedRefonly), but a tiny unit for collapsed handles would lock the contract in tests. Optional.
LGTM.
greg-in-a-box
left a comment
There was a problem hiding this comment.
Verdict: Approve
Clean consumer for comment_range_draft_dismiss: extract shared uncheckTimestamp, listen/cleanup next to the existing range-change handler, and only echo comment_range_draft_clear when the toggle was on.
What looks good
- Dismiss matches manual toggle-off (pressed off, pin dropped, end cleared, clear emitted) without resetting the captured start ms.
- Early return when already unchecked avoids a spurious clear.
- Hook tests cover dismiss-with-range, ignore-when-off, and re-press following pause/seek; ActivityFeedV2 covers the checkbox + clear emit path; attach/detach expectations include the new event.
Notes (non-blocking)
- Manual test plan’s “toggle on, no drag, then click outside” path isn’t covered by a dedicated unit case (only via press + change + dismiss). Behavior should already be correct via the
isPressedRefguard; optional follow-up. - Relies on the preview viewer actually emitting
comment_range_draft_dismiss— assumed by the PR description / companion change.
CI was still settling when I reviewed; lint_pull_request was green. No material issues for merge from the diff.
Merge Queue Status
This pull request spent 13 minutes 11 seconds in the queue, including 12 minutes 39 seconds running CI. Required conditions to merge
|
Summary
comment_range_draft_dismissfrom the audio viewer when the user clicks the waveform outside an open draft range.comment_range_draft_clearonly if the toggle was on, so the composer and viewer stay in sync.Test plan
comment_range_draft_clear.useMediaTimestamp.test.tsxandActivityFeedV2.test.tsx.Made with Cursor
Summary by CodeRabbit