diff --git a/.gitignore b/.gitignore index 14638f00..cc95b9c2 100644 --- a/.gitignore +++ b/.gitignore @@ -58,4 +58,6 @@ coverage *.tgz .scannerwork -test-data \ No newline at end of file +test-data + +.run \ No newline at end of file diff --git a/client/src/components/Planner/DayPlanSidebar.tsx b/client/src/components/Planner/DayPlanSidebar.tsx index 7be7c1e5..66590e1c 100644 --- a/client/src/components/Planner/DayPlanSidebar.tsx +++ b/client/src/components/Planner/DayPlanSidebar.tsx @@ -336,6 +336,10 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar({ return () => document.removeEventListener('dragend', cleanup) }, []) + // Initialize missing transport positions outside of render to avoid setState-during-render + // eslint-disable-next-line react-hooks/exhaustive-deps + useEffect(() => { days.forEach(day => initTransportPositions(day.id)) }, [days, reservations]) + const toggleDay = (dayId, e) => { e.stopPropagation() setExpandedDays(prev => { @@ -490,11 +494,6 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar({ const dn = (dayNotes[String(dayId)] || []).slice().sort((a, b) => a.sort_order - b.sort_order) const transport = getTransportForDay(dayId) - // Initialize positions for transports that don't have one yet - if (transport.some(r => r.day_plan_position == null)) { - initTransportPositions(dayId) - } - // All places keep their order_index — untimed can be freely moved, timed auto-sort when time is set const baseItems = [ ...da.map(a => ({ type: 'place' as const, sortKey: a.order_index, data: a })), @@ -1117,7 +1116,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar({ {/* Tagesliste */} -