fix(web): map broken after redirect from details (#19424)

* fix(web): map broken after redirect from details

* chore: use globalThis instead of window
This commit is contained in:
Yaros 2025-06-23 04:55:21 +02:00 committed by GitHub
parent ef278b4fb0
commit c705a7b280
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@
</script>
<script lang="ts">
import { afterNavigate } from '$app/navigation';
import Icon from '$lib/components/elements/icon.svelte';
import { Theme } from '$lib/constants';
import { modalManager } from '$lib/managers/modal-manager.svelte';
@ -213,6 +214,17 @@
}
};
afterNavigate(() => {
if (map) {
map.resize();
if (globalThis.location.hash) {
const hashChangeEvent = new HashChangeEvent('hashchange');
globalThis.dispatchEvent(hashChangeEvent);
}
}
});
onMount(async () => {
if (!mapMarkers) {
mapMarkers = await loadMapMarkers();