From ea0589b21e6edabf9cf5a383abe8be97019d8df2 Mon Sep 17 00:00:00 2001 From: xvilo Date: Sat, 5 Sep 2026 22:07:13 +0900 Subject: [PATCH] =?UTF-8?q?fix(journey):=20guard=20photo=20layer=20draw=20?= =?UTF-8?q?against=20map=20with=20no=20view=20yet=20Public=20journey=20pag?= =?UTF-8?q?es=20=E2=89=A51024px=20render=20the=20sticky=20sidebar=20map=20?= =?UTF-8?q?immediately=20with=20photos,=20before=20the=20deferred=20fitBou?= =?UTF-8?q?nds/setView=20lands,=20causing=20latLngToContainerPoint=20to=20?= =?UTF-8?q?throw=20"Set=20map=20center=20and=20zoom=20first."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Journey/JourneyMap.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/src/components/Journey/JourneyMap.tsx b/client/src/components/Journey/JourneyMap.tsx index a11828db5..28d230dff 100644 --- a/client/src/components/Journey/JourneyMap.tsx +++ b/client/src/components/Journey/JourneyMap.tsx @@ -405,6 +405,16 @@ function JourneyMap( photoLayerRef.current = null if (!photos?.length) return + // The initial view (setView/fitBounds) is set on a deferred rAF in the + // map-build effect above, so this can run before the map has a center/zoom + // — latLngToContainerPoint throws in that window. Skip; the moveend/zoomend + // listener below redraws once the deferred view lands. + try { + map.getCenter() + } catch { + return + } + const group = L.layerGroup() for (const cluster of clusterPhotos(map, photos)) { const marker = L.marker([cluster.lat, cluster.lng], {