fix(02-review): WR-06 skip redundant fallback init timer on later MeshMap reactivations

armMapVisibility() unconditionally scheduled a setTimeout(initMap, 300) on
every reactivation, not just the first mount. initMap()'s own guard made
this harmless (a no-op once the map exists), but it scheduled a throwaway
timer on every tab-switch back into Mesh. Guard the scheduling itself so
intent ("fallback init for the very first mount") matches behavior.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-07-31 02:21:07 -04:00
parent 751b05f271
commit 0486045d29

View File

@ -397,8 +397,10 @@ function armMapVisibility() {
}
// Fallback init for the very first mount (idempotent no-op once `map` is
// already set mirrors initMap's own not-yet-laid-out retry loop).
setTimeout(initMap, 300)
// already set mirrors initMap's own not-yet-laid-out retry loop). Guard
// against `map` already existing so later reactivations don't schedule a
// throwaway no-op timer (WR-06) this is genuinely first-mount-only.
if (!map) setTimeout(initMap, 300)
// A map laid out while the tab was off screen may have settled at a
// zero/partial size; re-tile it at its real size now that it's back on