diff --git a/neode-ui/src/components/MeshMap.vue b/neode-ui/src/components/MeshMap.vue index 2abc6943..9d1ecfed 100644 --- a/neode-ui/src/components/MeshMap.vue +++ b/neode-ui/src/components/MeshMap.vue @@ -421,12 +421,28 @@ function disarmMapVisibility() { // count as the first activation's arm, so onActivated only re-arms on a // genuine later reactivation, matching Mesh.vue's own meshFreshMount idiom. let mapMountFresh = true +// Set when a live geolocation watch is torn down by onDeactivated so +// onActivated can transparently resume it (WR-02) — the browser location +// watch must not keep firing (battery drain, background location indicator) +// while the Mesh tab is off screen, matching the only-while-visible pattern +// already applied to the resize listener/ResizeObserver in this file. +let wasSharingBeforeDeactivate = false onActivated(() => { if (mapMountFresh) { mapMountFresh = false; return } armMapVisibility() + if (wasSharingBeforeDeactivate) { + wasSharingBeforeDeactivate = false + startSharing() + } }) onMounted(() => armMapVisibility()) -onDeactivated(() => disarmMapVisibility()) +onDeactivated(() => { + disarmMapVisibility() + if (sharingLocation.value) { + wasSharingBeforeDeactivate = true + stopSharing() + } +}) onUnmounted(() => { disarmMapVisibility()