Skip to content

fix(marketing): prerender the sitemap again - #8128

Merged
saddlepaddle merged 1 commit into
mainfrom
saddlepaddle/sitemap-static
Oct 4, 2026
Merged

saddlepaddle merged 1 commit into
mainfrom
saddlepaddle/sitemap-static

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Since #8101 the production sitemap is rendered on every request (ƒ /sitemap.xml in the build log, CDN miss on every fetch). Before, it was a static file refreshed on an interval.

Cause

The sitemap reads the mobile-launch flag through unstable_cache. With cacheComponents on, the PostHog request inside it ends a route handler's prerender, so Next marks the route dynamic. It only happens when the PostHog host is reachable, which is why my local builds with a placeholder host stayed static.

What changes

getSiteFlag is a "use cache" function with the same one-minute lifetime. A failed read still returns false.

Verified locally

  • With a real PostHog host: ƒ /sitemap.xml before the change, ○ /sitemap.xml 1m after.
  • Served build: the sitemap is a cache hit with 3,028 URLs including profiles; pricing, a non-English page, /mobile, a profile and a 404 behave as before.
  • With the API unreachable at build, the build passes and the sitemap is static without profile URLs until its next refresh.
  • Typecheck and the marketing tests pass.

Not verified

  • The production build log and the live x-vercel-cache header, which only exist after merge.

Summary by cubic

Restores prerendering for the production sitemap, which has been rendered on every request since cacheComponents was enabled. The feature-flag read went through unstable_cache, and the PostHog call inside it ended the route handler's prerender, so Next marked the route dynamic.

getSiteFlag is now a "use cache" function with the same one-minute lifetime, and a failed read still returns false. The sitemap is static again with a one-minute refresh.

Verified locally with a reachable PostHog host (ƒ /sitemap.xml before, ○ /sitemap.xml 1m after) and with the API unreachable at build (static, no profile URLs until refresh). Production build log and live x-vercel-cache header can only be checked after merge.

Written for commit 5cb2fa7. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Site flags continue to refresh every 60 seconds, and flag evaluation failures continue to return false.

The sitemap has been rendered on every request since cacheComponents
was turned on. Its feature-flag read went through unstable_cache, and
the PostHog call inside it ends a route handler's prerender, so Next
gave up and marked the route dynamic. The flag read is now a
"use cache" function with the same one-minute lifetime, and the
sitemap is static with a one-minute refresh, as it was before.

It only reproduced with a reachable PostHog host, which is why local
builds with a placeholder host stayed static.
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c13532f8-8745-47f0-8eb5-d3d980d152f8
📥 Commits

Reviewing files that changed from the base of the PR and between df26d7f and 5cb2fa7.

📒 Files selected for processing (1)
  • apps/marketing/src/lib/site-flags.ts
 __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
< I've seen things you people wouldn't believe. Inefficient loops on fire off the shoulder of Orion. I've observed algorithms unfold in the dark near the Tannhäuser Gate, and watched data structures dissolve into the void of garbage collection. All those moments will be lost in my transient GPU cache, like tears in rain. >
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@saddlepaddle
saddlepaddle merged commit b3179c5 into main Oct 4, 2026
18 of 19 checks passed
@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Switches the marketing site caching strategy for feature flags.

The PR should not merge until a transient failed flag read can recover without caching the off state.

Findings

  1. P1 Failed flag reads stay cached ▶
Fix with agent prompt
### Issue 1
apps/marketing/src/lib/site-flags.ts:20-22
If PostHog briefly fails after mobile has launched, this catch returns `false` from inside the cached function. That off value can remain cached after PostHog recovers, temporarily removing mobile from the sitemap and marking its page `noindex`. Keep the fallback outside the cache boundary, or avoid caching failed reads.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR replaces the sitemap’s unstable_cache-backed site flag with a "use cache" function to restore prerendering and one-minute revalidation.

  • A failed PostHog read now caches the off state, which can temporarily put mobile discovery and page metadata out of sync with the recovered flag.

Reviews (1) · Last reviewed commit: "fix(marketing): prerender the sitemap ag..."

Comment on lines 20 to 22
} catch (error) {
console.error(`[site-flags] Failed to load ${flag}`, error);
return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Failed flag reads stay cached

If PostHog briefly fails after mobile has launched, this catch returns false from inside the cached function. That off value can remain cached after PostHog recovers, temporarily removing mobile from the sitemap and marking its page noindex. Keep the fallback outside the cache boundary, or avoid caching failed reads.

Knowledge Base Used:

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/marketing/src/lib/site-flags.ts
Line: 20-22

Comment:
**Failed flag reads stay cached**

If PostHog briefly fails after mobile has launched, this catch returns `false` from inside the cached function. That off value can remain cached after PostHog recovers, temporarily removing mobile from the sitemap and marking its page `noindex`. Keep the fallback outside the cache boundary, or avoid caching failed reads.

**Knowledge Base Used:**
- [Marketing product site](https://app.greptile.com/personal-org-6810/-/custom-context/knowledge-base/superset-sh/superset/-/docs/marketing-product-site.md)
- [Marketing routes and content delivery](https://app.greptile.com/personal-org-6810/-/custom-context/knowledge-base/superset-sh/superset/-/docs/marketing-routes-and-content-delivery.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

This branch was previously deployed

1 inactive deployment
preview — 5cb2fa77 Deployed Oct 4, 2026 by saddlepaddle via Deploy Marketing #10999
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.

1 participant