With PRELOAD_MAP=true, the explore-page map stays at the world view instead of zooming to the results. The console shows TypeError: Cannot read properties of undefined (reading 'getData') from the map search code.
Cause. getBoundingBox in src/apps/search/map/MapSearchContext.tsx has two paths. Without preload it computes the box from the features it already has. With preload it calls map.getSource('source-' + uuid).getData() for every visible feature — assuming each feature's source is already on the map. The zoom effect can run before MultiLayer has added them all, so getSource returns undefined and the call throws an error. The error happens inside the Promise executor, so the promise never settles and nothing retries: the map sits at 0/0/0.
Sites without PRELOAD_MAP never run this path, which is why most sites zoom fine.
Suggested fix. In the preload path, when getSource returns nothing, fall back to the feature itself (what the non-preload path does) or wait for the source to register — and make the promise settle on failure so the zoom can retry.
Seen on a static build (which requires PRELOAD_MAP=true for the geometry snapshot), but reproducible on any deployment with the flag on.
With
PRELOAD_MAP=true, the explore-page map stays at the world view instead of zooming to the results. The console showsTypeError: Cannot read properties of undefined (reading 'getData')from the map search code.Cause.
getBoundingBoxinsrc/apps/search/map/MapSearchContext.tsxhas two paths. Without preload it computes the box from the features it already has. With preload it callsmap.getSource('source-' + uuid).getData()for every visible feature — assuming each feature's source is already on the map. The zoom effect can run beforeMultiLayerhas added them all, sogetSourcereturns undefined and the call throws an error. The error happens inside the Promise executor, so the promise never settles and nothing retries: the map sits at0/0/0.Sites without
PRELOAD_MAPnever run this path, which is why most sites zoom fine.Suggested fix. In the preload path, when
getSourcereturns nothing, fall back to the feature itself (what the non-preload path does) or wait for the source to register — and make the promise settle on failure so the zoom can retry.Seen on a static build (which requires
PRELOAD_MAP=truefor the geometry snapshot), but reproducible on any deployment with the flag on.