Skip to content

refactor(web): narrow draft reads for drag grid helpers#2352

Merged
tyler-dane merged 1 commit into
mainfrom
refactor/narrow-draft-drag-context-reads
Jul 24, 2026
Merged

refactor(web): narrow draft reads for drag grid helpers#2352
tyler-dane merged 1 commit into
mainfrom
refactor/narrow-draft-drag-context-reads

Conversation

@tyler-dane

Copy link
Copy Markdown
Contributor

Summary

  • Add useDraftDragMotion exposing only isDragging, hasDraft, and isTimedDraft.
  • Wire useDragEdgeNavigation and useDragEventSmartScroll through that hook instead of full useDraftContext.

Simplicity

Net reduction in coupling: drag grid helpers no longer depend on draft actions or the full local draft object. Hook complexity stayed flat — no new useEffect/useRef/useState beyond the existing ones in the two consumers. Kept existing useEffects in both helpers because they sync to window mouse listeners and rAF loops.

Manual Testing Steps

  • Drag a timed event near the left/right edge of the week grid → week advances after a short dwell.
  • Drag a timed event near the top/bottom of the timed grid → grid scrolls while dragging.
  • Drag an all-day event → no timed-grid smart scroll.
  • Stop dragging → edge nav and scroll stop.

Test plan

  • bun test:web packages/web/src/views/Week/components/Grid/MainGrid/MainGrid.test.tsx packages/web/src/views/Week/components/Grid/MainGrid/eventReadOnlyInteraction.test.tsx (24 pass)
  • bun run type-check:web-tests + web app tsc --noEmit
  • bun lint (pre-existing unused-import warning in __tests__/render-with-store.tsx)

Made with Cursor

Add useDraftDragMotion so edge navigation and smart scroll depend on
isDragging / draft presence / timed-ness instead of full DraftContext.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tyler-dane
tyler-dane merged commit 1bae392 into main Jul 24, 2026
19 checks passed
@tyler-dane
tyler-dane deleted the refactor/narrow-draft-drag-context-reads branch July 24, 2026 03:52
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