The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(planner): the drag state setters are stable, so the sidebar's dragend listener lists them and is still set up once
Maurice860ffc1deee1
diff --git a/client/src/components/Planner/DayPlanSidebar.tsx b/client/src/components/Planner/DayPlanSidebar.tsxindex 10cf92589..40d0a3a68 100644--- a/client/src/components/Planner/DayPlanSidebar.tsx+++ b/client/src/components/Planner/DayPlanSidebar.tsx@@ -373,7 +373,7 @@ function useDayPlanSidebar(props: DayPlanSidebarProps) {}document.addEventListener('dragend', cleanup)return () => document.removeEventListener('dragend', cleanup)- }, [])+ }, [setDraggingId, setDropTargetKey, setDragOverDayId])// Initialize missing transport positions outside of render to avoid setState-during-render// eslint-disable-next-line react-hooks/exhaustive-depsdiff --git a/client/src/components/Planner/useDayPlanDragState.ts b/client/src/components/Planner/useDayPlanDragState.tsindex 1e81387f5..51af8b614 100644--- a/client/src/components/Planner/useDayPlanDragState.ts+++ b/client/src/components/Planner/useDayPlanDragState.ts@@ -1,4 +1,4 @@-import { useEffect, useRef, useState, type MutableRefObject } from 'react';+import { useCallback, useEffect, useRef, useState, type MutableRefObject } from 'react';/** A stop's or a day's id, as the day plan's drag handlers pass them around. */type DragKey = string | number | null;@@ -27,14 +27,15 @@ export function useDayPlanDragState(dragDataRef: MutableRefObject<unknown>) {const dropTargetRef = useRef<string | null>(null);const [dragOverDayId, setDragOverDayId] = useState<DragKey>(null);- const setDraggingId = (id: DragKey) => {+ // Stable, so the sidebar's listeners that call them are set up once.+ const setDraggingId = useCallback((id: DragKey) => {if (id != null) setHasDragged(true);setDraggingIdState(id);- };- const setDropTargetKey = (key: string | null) => {+ }, []);+ const setDropTargetKey = useCallback((key: string | null) => {dropTargetRef.current = key;setDropTargetKeyState(key);- };+ }, []);useEffect(() => {if (!draggingId && !dropTargetKey && !dragOverDayId) return;