fix(landing): fix Core Web Vitals regressions across public marketing pages#5522
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview On hosted, the root layout no longer always renders Bundle and interaction tweaks: always-visible Reviewed by Cursor Bugbot for commit 87cd4e5. Configure here. |
Greptile SummaryThis PR improves Core Web Vitals across the public landing and content pages. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(landing): escape </script> breakout ..." | Re-trigger Greptile |
… pages - root layout unconditionally rendered next-runtime-env's PublicEnvScript, which calls unstable_noStore() and silently forced every route in the app dynamic - marketing pages never got static/ISR caching despite their own revalidate. Gated it to self-hosted only; hosted now uses a static, build-time equivalent (app/_shell/public-env-script.tsx) - removed real pointer-drag handlers from the hero's decorative workflow animation (was draggable despite being aria-hidden) - disabled dragging/panning on the (currently unmounted) landing-preview ReactFlow canvas so it's static-by-default if it's ever wired in - lazy-mount the Product Demo section's duplicate HeroVisual instance via next/dynamic + IntersectionObserver instead of loading it eagerly below the fold - disabled Next.js Link prefetch on always-in-viewport /signup and /login CTAs (navbar, hero, mobile nav) so their JS isn't fetched on every pageview regardless of whether the visitor clicks - removed `unoptimized` from local blog/integration images (including the priority LCP image on every blog post), letting next/image serve resized AVIF/WebP instead of full-size originals
- revert prefetch={false} on below-fold CTAs (cta.tsx, enterprise.tsx) -
contradicts the prefetch-on-approach rule this PR itself documents
- restore unoptimized on avatarUrl and the MDX body-image renderer, both of
which can legitimately hold external URLs outside next.config.ts's
image remotePatterns allow-list
- simplify handleAnchors to a single block argument now that positions are
static (the second "live position" argument was always identical to the
first after the drag-handler removal)
- extract the near-duplicate IntersectionObserver lazy-mount logic shared
by landing-preview-mount.tsx and product-demo-visual-mount.tsx into a
single apps/sim/app/(landing)/hooks/use-lazy-mount.ts hook
- import next-runtime-env's own exported PUBLIC_ENV_KEY constant instead of
a hardcoded string literal, and match its case-insensitive NEXT_PUBLIC_
filter exactly, removing any drift risk between the two implementations
- drop plain inline comments with no TSDoc home in favor of relying on the
existing TSDoc/CLAUDE.md documentation
…-*-page components The blog/library split (#5516) moved the blog post/index/author JSX into shared ContentPostPage/ContentIndexPage/ContentAuthorPage components while this branch was in flight, so the original unoptimized removal (verified local-only ogImage paths for both blog and library content) needs to land on those shared components instead of the old per-route JSX.
a4f3aaa to
adf6109
Compare
…d structure doc - add a one-line comment on ContentFrontmatterSchema.ogImage documenting that it's rendered without unoptimized and expects a local path, matching the existing avatarUrl comment convention (a reviewer noted ogImage's schema is technically unconstrained and seo.ts has an http-prefix branch, though all current content is local) - add the new hooks/ folder to the (landing) CLAUDE.md structure diagram and name use-lazy-mount.ts directly in the lazy-mount rule
Greptile P1: a NEXT_PUBLIC_* value containing "</script>" would close the inline script early and could inject markup/script into every hosted page. Escape "<" in the serialized JSON before interpolating it, matching the standard JSON-in-script-tag safeguard.
|
@greptile-apps review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 87cd4e5. Configure here.
Summary
next-runtime-env'sPublicEnvScript, which callsunstable_noStore()and silently forced every route in the app into dynamic rendering - marketing pages never got static/ISR caching despite their ownrevalidate. Confirmed viabun run build's route table (ƒ→○/●) and prod'sCache-Control: private, no-storeheader. Gated it to self-hosted only; hosted now uses a static, build-time equivalent (app/_shell/public-env-script.tsx) that populates the samewindow.__ENVglobal.aria-hidden.HeroVisualinstance vianext/dynamic+IntersectionObserverinstead of loading it eagerly below the fold.<Link>prefetch on always-in-viewport/signupand/loginCTAs (navbar, hero, mobile nav) so their JS isn't fetched on every pageview regardless of whether the visitor clicks.unoptimizedfrom local blog/integration images (including the priority LCP image on every blog post), lettingnext/imageserve resized AVIF/WebP instead of full-size originals.(landing)/CLAUDE.md(decorative-canvas-must-be-static, lazy-mount pattern, prefetch={false} convention, root-layout dynamic-rendering gotcha).Type of Change
Testing
bun run build --filter=simwithNEXT_PUBLIC_APP_URL=https://sim.ai(isHosted=true):/,/enterprise,/workflows,/solutions/*,/demo,/blog/tags,/blog/[slug],/models/[provider],/models/[provider]/[model],/integrations/[slug]all flip fromƒto○/●.window['__ENV']renders correctly in the static HTML output with real values.next startlocally: response header changes fromCache-Control: private, no-cache, no-storetoCache-Control: no-cache, must-revalidate(ISR-eligible) on/.tsc --noEmitclean (no new errors),bun run lintclean.Checklist