From 11ac4c9eb2ad30f6131cc0eccc0cbbc59063dcfc Mon Sep 17 00:00:00 2001 From: Nico Date: Thu, 4 Jun 2026 07:05:38 -0700 Subject: [PATCH] fix: avoid duplicate hidden map recovery --- frontend/src/components/maps/LocationMapBottomSheet.jsx | 6 +++++- frontend/tests/location-map-manager.spec.ts | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/maps/LocationMapBottomSheet.jsx b/frontend/src/components/maps/LocationMapBottomSheet.jsx index da3897e..05cfb7a 100644 --- a/frontend/src/components/maps/LocationMapBottomSheet.jsx +++ b/frontend/src/components/maps/LocationMapBottomSheet.jsx @@ -94,6 +94,8 @@ export default function LocationMapBottomSheet({ const visibleAreaCount = filters.showZones ? Math.max(0, totalAreaCount - hiddenAreaCount) : 0; + const hasNoVisibleAreas = + filters.showZones && totalAreaCount > 0 && visibleAreaCount === 0 && hiddenAreaCount > 0; const showMapOverview = mode !== "edit" && !selectedObject; const unlinkedAreaCount = useMemo( () => mapObjects.filter((object) => !objectZoneId(object)).length, @@ -109,6 +111,8 @@ export default function LocationMapBottomSheet({ const hasHiddenUnmappedItems = filters.showUnmapped && unmappedItemCount > 0 && visibleUnmappedItems.length === 0; const hiddenAreaLabel = `Show Hidden Areas (${hiddenAreaCount})`; + const showHiddenAreaAction = + showEditorControls && hiddenAreaCount > 0 && filters.showZones && !hasNoVisibleAreas; const saveDraftLabel = savingAction === "save" ? "Saving..." : "Save Draft"; const publishLabel = savingAction === "publish" ? "Publishing..." : "Publish"; const mappedItemSummary = assignedItemCount === visibleAssignedItemCount @@ -236,7 +240,7 @@ export default function LocationMapBottomSheet({ ) : editorActions} - {showEditorControls && hiddenAreaCount > 0 ? ( + {showHiddenAreaAction ? (