Skip to content

Fix saved-search map markers by rebuilding features from hits#618

Open
jamiefolsom wants to merge 1 commit intodevelopfrom
fix/saved-search-map-markers
Open

Fix saved-search map markers by rebuilding features from hits#618
jamiefolsom wants to merge 1 commit intodevelopfrom
fix/saved-search-map-markers

Conversation

@jamiefolsom
Copy link
Copy Markdown
Member

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

SaveButton writes both hits and features to the saved session. On restore, Map.tsx (visualizations) sees the features array and calls fetchGeometry(uuid) once per feature. fetchGeometry hits /api/geometry/[uuid].json, a prerender = true route whose getStaticPaths enumerates the geometry Astro content collection. That collection is only registered in content.config.ts when PRELOAD_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 through fetchGeometry.)

Fix

  • Map.tsx: build features from hits via TypesenseUtils.getFeatures whenever hits are present — same path the live search page uses. Fall back to per-feature fetchGeometry only when hits are absent (legacy sessions on deployments that do preload geometry).
  • SaveButton.tsx: drop the features array from the saved payload; only persist hits plus metadata.

Closes #616.

Test plan

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
@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for gbof-c19nyc-staging ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/gbof-c19nyc-staging/deploys/69f4dfa26ad5300008a304e6
😎 Deploy Preview https://deploy-preview-618--gbof-c19nyc-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for juel-ancestry ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/juel-ancestry/deploys/69f4dfa2effb5a0008986249
😎 Deploy Preview https://deploy-preview-618--juel-ancestry.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for juel-life ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/juel-life/deploys/69f4dfa26d7b080008a726af
😎 Deploy Preview https://deploy-preview-618--juel-life.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for pss-scavenger-hunt ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/pss-scavenger-hunt/deploys/69f4dfa182d0ff00082d1570
😎 Deploy Preview https://deploy-preview-618--pss-scavenger-hunt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for juel-staging ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/juel-staging/deploys/69f4dfa2be87a50007483871
😎 Deploy Preview https://deploy-preview-618--juel-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for libertos ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/libertos/deploys/69f4dfa21e8626000809d0fb
😎 Deploy Preview https://deploy-preview-618--libertos.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for registro-project ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/registro-project/deploys/69f4dfa21444d80007a6b95b
😎 Deploy Preview https://deploy-preview-618--registro-project.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for gamepossible ready!

Name Link
🔨 Latest commit 73bc5ed
🔍 Latest deploy log https://app.netlify.com/projects/gamepossible/deploys/69f4dfa2da2f4f00084c3dbc
😎 Deploy Preview https://deploy-preview-618--gamepossible.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jamiefolsom
Copy link
Copy Markdown
Member Author

Verified locally on deploy/marronage with this commit cherry-picked.

Steps: cdp-dev marronage --skip-clean, ran a Places search with a Type filter, saved as test-616-fix, restored from Saved Searches.

Result: map renders place markers and certainty radii on restore. DevTools Network tab shows no 404 /api/geometry/<uuid>.json calls during restore — confirms Map.tsx takes the new hits-first path. Table and Timeline views unchanged. Live /en/search/places/ and /en/search/events/ unchanged.

The cherry-pick was reset locally — fix lives only on this branch. Leaving open for dev review before merging to develop.

@camdendotlol
Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Saved search from Places view doesn't render map markers when restored

2 participants