fix(frontend): fix 4 DnD bugs + CalendarView sidebar TS errors - #342
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
DayTimeline: usefetchPlanRange(date, date)instead offetchPlan()after promotion.fetchPlantogglesloading=true, triggeringPlanView'sv-if="planStore.loading"to destroy/remount the entire plan grid on every drop.DayTimeline: replace local-naive ISO construction ("2026-05-09T14:00:00") withDate + setHours + toISOString(). Backend treated naive strings as UTC, placing promoted events 7h early in PDT.CalendarViewsidebar: adddraggingTaskIdref +v-show+requestAnimationFramedeferral on task<li>elements. MirrorsAnchorBlock.vuepattern to eliminate post-drop source flicker.slotIndexFromClientY: guard against non-finiteclientYto prevent NaN propagation.TS fix (the reason #338 was reverted):
The inline
@dragstarttemplate handler usedrequestAnimationFrame(not a component instance method in vue-tsc's view) anddraggingTaskId.value(.valuedoesn't exist on the template-unwrappedstring | nulltype). Extracted toonSidebarTaskDragStart()in<script setup>wheredraggingTaskIdis correctly typed asRef<string | null>.Test plan
npm run build(vite build + vue-tsc): zero type errorsvitest run: 591/591 passingfetchPlanRangecalled after promotion; UTC Z-suffix on both promote and move paths