Fix saved-search map markers by rebuilding features from hits#618
Fix saved-search map markers by rebuilding features from hits#618jamiefolsom wants to merge 1 commit intodevelopfrom
Conversation
Saved-search restore was calling fetchGeometry per feature, hitting the prerendered /api/geometry/[uuid].json route. That route only enumerates UUIDs in the geometry content collection, which is empty unless PRELOAD_MAP=true. On server-mode deploys without that flag every fetch 404s, leaving the map empty. Restore now mirrors the live search page: build features from the saved hits via TypesenseUtils.getFeatures. The stored payload no longer includes a separate features array. Closes #616
✅ Deploy Preview for gbof-c19nyc-staging ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for juel-ancestry ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for juel-life ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for pss-scavenger-hunt ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for juel-staging ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for libertos ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for registro-project ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for gamepossible ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Verified locally on Steps: Result: map renders place markers and certainty radii on restore. DevTools Network tab shows no The cherry-pick was reset locally — fix lives only on this branch. Leaving open for dev review before merging to |
|
I wonder if this is the same issue that #561 fixed, but this time on saved searches as opposed to embeds. I'll dig deeper into it on Monday. |
Summary
Saved searches restore an empty map (no markers, no certainty radii) on any deployment that does not preload the geometry content collection. Affects any server-mode CDP site without
PRELOAD_MAP=true, including marronage staging.Root cause
SaveButtonwrites bothhitsandfeaturesto the saved session. On restore,Map.tsx(visualizations) sees thefeaturesarray and callsfetchGeometry(uuid)once per feature.fetchGeometryhits/api/geometry/[uuid].json, aprerender = trueroute whosegetStaticPathsenumerates thegeometryAstro content collection. That collection is only registered incontent.config.tswhenPRELOAD_MAP=true && !USE_CONTENT_CACHE. With neither flag set, the static endpoint exists with zero paths, every request 404s, and the map renders nothing. (Table and timeline views work because they don't go throughfetchGeometry.)Fix
Map.tsx: build features fromhitsviaTypesenseUtils.getFeatureswhenever hits are present — same path the live search page uses. Fall back to per-featurefetchGeometryonly when hits are absent (legacy sessions on deployments that do preload geometry).SaveButton.tsx: drop thefeaturesarray from the saved payload; only persisthitsplus metadata.Closes #616.
Test plan
/en/search/places/, restore it, confirm markers render/en/search/events//en/search/places/and/en/search/events/live map views unchanged