From e108c9361a44f80694b139c6c6fc7901d839c615 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Thu, 16 Apr 2026 03:40:06 +1000 Subject: [PATCH] fix(google-maps): prevent blank space during page transitions Removing the map DOM in onBeforeUnmount caused a visible blank space while the leave animation was playing, because Vue removes the parent element on actual unmount. Let Vue handle DOM cleanup instead. --- .../src/runtime/components/GoogleMaps/ScriptGoogleMaps.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMaps.vue b/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMaps.vue index b3fabf9e..25050246 100644 --- a/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +++ b/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMaps.vue @@ -479,9 +479,11 @@ onBeforeUnmount(() => { // so anything after an `await` runs as a detached microtask. // Note: do NOT null mapsApi here — children unmount AFTER onBeforeUnmount // and need mapsApi.value for clearInstanceListeners in their cleanup. + // Note: do NOT remove map DOM here — during page transitions the leave + // animation is still playing, and tearing out the iframe leaves blank + // space. Vue removes the parent element on actual unmount. map.value?.unbindAll() map.value = undefined - mapEl.value?.firstChild?.remove() libraries.clear() queryToLatLngCache.clear() })