From 2c0c6aad8319edc9f9fd2bf9264fb41d73797f12 Mon Sep 17 00:00:00 2001 From: jubnl Date: Fri, 15 May 2026 21:57:50 +0200 Subject: [PATCH] fix(planner): remove correct assignment when place assigned to same day multiple times When a place was assigned to the same day more than once, the "Remove from day" button in PlaceInspector always deleted the first assignment (Array.find on place.id) instead of the currently selected one. Now prefers selectedAssignmentId when available. Fixes #1005 --- client/src/components/Planner/PlaceInspector.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/Planner/PlaceInspector.tsx b/client/src/components/Planner/PlaceInspector.tsx index 9e09f1ff..881ff253 100644 --- a/client/src/components/Planner/PlaceInspector.tsx +++ b/client/src/components/Planner/PlaceInspector.tsx @@ -169,7 +169,10 @@ export default function PlaceInspector({ const category = categories?.find(c => c.id === place.category_id) const dayAssignments = selectedDayId ? (assignments[String(selectedDayId)] || []) : [] - const assignmentInDay = selectedDayId ? dayAssignments.find(a => a.place?.id === place.id) : null + const assignmentInDay = selectedDayId + ? ((selectedAssignmentId ? dayAssignments.find(a => a.id === selectedAssignmentId) : null) + ?? dayAssignments.find(a => a.place?.id === place.id)) + : null const openingHours = googleDetails?.opening_hours || null const openNow = googleDetails?.open_now ?? null