Repository navigation
fix(cow-fi): server-render pages by isolating UTM useSearchParams - #8548
Draft
riboflavin wants to merge 1 commit into
Draft
riboflavin wants to merge 1 commit into
riboflavin wants to merge 1 commit into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
|
@riboflavin is attempting to deploy a commit to the cow-dev Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes cow-fi pages server-render their content in production. Today most pages ship an almost empty HTML shell and fill in on the client, so crawlers (including AI/LLM crawlers that don't run JS) see little or nothing.
Layout('use client') calleduseSetupPage()→useInitializeUtm()→useSearchParams(). Under the app-wide<Suspense>inapp/providers.tsx, that makes Next bail out of prerendering the whole page to client-side rendering.useSetupPage()call into a newUtmInitializerclient component that rendersnull, wrapped in its own<Suspense fallback={null}>insideLayout. Only that empty boundary is client-rendered now.<Suspense>fromapp/providers.tsx. Leaving it in made page content stream inside a hidden<div hidden id="S:0">instead of inline in the HTML.No changes to routing, caching (
revalidate), data fetching, or UTM logic.To Test
Needs a production build; dev mode doesn't reproduce this (
next build && next startinapps/cow-fi).curl -s http://localhost:3000/resources/price-guide(or view source)/and/cow-swap/?utm_source=test&utm_medium=qa&utm_campaign=x: params are stripped from the URL after a few seconds, and home page links still carryutm__source=cow.fi&utm__medium=web&utm__content=.../resources/campaignand/resources/price-guide/nopereturn HTTP 404Background
Visible words in the prerendered HTML (production build), before → after:
/resources/price-guide/resources//cow-swapThe only remaining bailout marker is the empty
UtmInitializerboundary. As a side effect, missing campaigns/resources now return a real 404 instead of a 200 soft 404.UTM behavior was compared in a browser against an unchanged baseline build: URL cleanup and link params are identical.
Not addressed: unknown top-level URLs (e.g.
/this-page-does-not-exist) still return 200 via the catch-all route; that is pre-existing.Local checks:
cow-fi:test(106 tests), lint (0 errors),agents:check, andcow-fi:test-cms-resilience(CMS unavailable / malformed / stalled, 46 pages each) pass. I'm relying on CI for typecheck.Self-checks