From abdfa07a77fccabc125c8afd7ce186df4bb1784d Mon Sep 17 00:00:00 2001 From: archipelago Date: Thu, 30 Jul 2026 16:16:40 -0400 Subject: [PATCH] feat(02-05): bound the Leaflet map's lifecycle across Mesh tab deactivation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MeshMap.vue's onMounted setup (window resize listener + ResizeObserver) is refactored into an idempotent armMapVisibility()/disarmMapVisibility() pair, dual-registered on both onMounted and onActivated (onActivated is a documented no-op outside a KeepAlive boundary) and torn down on onDeactivated, matching the arm/disarm idiom Mesh.vue itself already uses. The Leaflet instance is never destroyed or recreated by this — initMap()'s own `if (!mapContainer.value || map) return` guard already makes construction idempotent, so exactly one map is built per session. On reactivation the map's size is invalidated via nextTick so a map laid out while off screen re-tiles at its real size instead of showing an unsized or partially tiled canvas. FLAGGED: RESEARCH.md's premise that Mesh.vue owns a live D3 force simulation does not hold for this codebase — a grep for d3/forceSimulation/simulation across neode-ui/src found nothing in Mesh.vue's or MeshMap.vue's tree; the only D3 force simulation belongs to NetworkMap.vue (Federation.vue's graph, out of this plan's scope). The plan's D3-specific truths are therefore vacuously satisfied — see 02-05-SUMMARY.md for detail. Only the real Leaflet-map lifecycle work landed here. meshMapLifecycle.test.ts is a new, separate file (not appended to meshTabCache.test.ts) because its vi.mock('@/stores/mesh')/vi.mock('leaflet') hoist file-wide and would otherwise clobber meshTabCache.test.ts's need for the real mesh/transport stores — mirrors the MarketplaceRefresh.test.ts precedent from 02-02 for the same class of vi.mock-hoisting conflict. Co-Authored-By: Claude Fable 5 --- neode-ui/src/components/MeshMap.vue | 78 ++++++-- .../__tests__/meshMapLifecycle.test.ts | 166 ++++++++++++++++++ 2 files changed, 226 insertions(+), 18 deletions(-) create mode 100644 neode-ui/src/components/__tests__/meshMapLifecycle.test.ts diff --git a/neode-ui/src/components/MeshMap.vue b/neode-ui/src/components/MeshMap.vue index f98a2245..2abc6943 100644 --- a/neode-ui/src/components/MeshMap.vue +++ b/neode-ui/src/components/MeshMap.vue @@ -1,5 +1,5 @@