diff --git a/website/src/lib/stores.ts b/website/src/lib/stores.ts index b053fd26..4349d24b 100644 --- a/website/src/lib/stores.ts +++ b/website/src/lib/stores.ts @@ -81,10 +81,14 @@ targetMapBounds.subscribe((bounds) => { return; } - get(map)?.fitBounds(bounds.bounds, { - padding: 80, - linear: true, - easing: () => 1 + map.subscribe((m) => { + if (m) { + m.fitBounds(bounds.bounds, { + padding: 80, + linear: true, + easing: () => 1 + }); + } }); });