Skip to content

fix(frontend): fix 4 DnD bugs + CalendarView sidebar TS errors - #342

Merged
jlunder00 merged 2 commits into
mainfrom
fix/calendar-sidebar-dragstart-ts
May 10, 2026
Merged

fix(frontend): fix 4 DnD bugs + CalendarView sidebar TS errors#342
jlunder00 merged 2 commits into
mainfrom
fix/calendar-sidebar-dragstart-ts

Conversation

@jlunder00

Copy link
Copy Markdown
Owner

Summary

Re-applies the DnD fixes from #338 (which was reverted due to Docker build failure) with the TypeScript errors corrected.

Bug fixes (same as #338):

  • Bug 1+3DayTimeline: use fetchPlanRange(date, date) instead of fetchPlan() after promotion. fetchPlan toggles loading=true, triggering PlanView's v-if="planStore.loading" to destroy/remount the entire plan grid on every drop.
  • Bug 2DayTimeline: replace local-naive ISO construction ("2026-05-09T14:00:00") with Date + setHours + toISOString(). Backend treated naive strings as UTC, placing promoted events 7h early in PDT.
  • Bug 5CalendarView sidebar: add draggingTaskId ref + v-show + requestAnimationFrame deferral on task <li> elements. Mirrors AnchorBlock.vue pattern to eliminate post-drop source flicker.
  • HardeningslotIndexFromClientY: guard against non-finite clientY to prevent NaN propagation.

TS fix (the reason #338 was reverted):
The inline @dragstart template handler used requestAnimationFrame (not a component instance method in vue-tsc's view) and draggingTaskId.value (.value doesn't exist on the template-unwrapped string | null type). Extracted to onSidebarTaskDragStart() in <script setup> where draggingTaskId is correctly typed as Ref<string | null>.

Test plan

  • npm run build (vite build + vue-tsc): zero type errors
  • vitest run: 591/591 passing
  • 3 new regression tests: fetchPlanRange called after promotion; UTC Z-suffix on both promote and move paths

jlunder00 added 2 commits May 10, 2026 00:39
- DayTimeline: use fetchPlanRange(date, date) instead of fetchPlan after
  promoting a task to calendar. fetchPlan flips loading=true which causes
  PlanView's v-if="planStore.loading" to destroy and remount the entire
  plan grid — fixing the full-page flash (Bug 1) and between-anchor DnD
  appearing broken (Bug 3) simultaneously.

- DayTimeline: replace local-naive ISO string construction with
  Date + setHours + toISOString() in handleSlotDrop. Local-naive strings
  like "2026-05-09T14:00:00" are treated as UTC by the backend, placing
  promoted events 7h early in PDT. Both the new-promotion path and the
  existing-event-move path are fixed (Bug 2).

- DayTimeline: guard slotIndexFromClientY against non-finite clientY to
  prevent NaN propagation into Date construction (hardening).

- CalendarView: add draggingTaskId ref + v-show + requestAnimationFrame
  deferral to sidebar task <li> elements. Mirrors AnchorBlock.vue pattern
  so the source task hides after the browser snapshots the drag ghost
  image, eliminating the source-flicker after drop (Bug 5).

Tests: 14 DayTimeline DnD tests pass (3 new regression tests for UTC
times and fetchPlanRange behavior, existing tests updated to use
timezone-safe UTC assertions). Full suite: 591/591 passing.
… errors

The inline @dragstart handler in CalendarView.vue's sidebar used
requestAnimationFrame (not a component method) and draggingTaskId.value
(.value doesn't exist on the template-unwrapped string | null type),
causing three vue-tsc errors in the Docker build.

Extract to onSidebarTaskDragStart() in script setup where draggingTaskId
is correctly typed as Ref<string | null> and requestAnimationFrame is
available as a global. Template now calls the function with the task,
anchor id, and focusedDay as arguments.
@jlunder00
jlunder00 merged commit 11a9233 into main May 10, 2026
7 checks passed
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