Skip to content

feat(core): wrap layout-level guest queries in unstable_cache#2978

Open
jorgemoya wants to merge 2 commits intocanaryfrom
LTRAC-226/guest-cache-layout
Open

feat(core): wrap layout-level guest queries in unstable_cache#2978
jorgemoya wants to merge 2 commits intocanaryfrom
LTRAC-226/guest-cache-layout

Conversation

@jorgemoya
Copy link
Copy Markdown
Contributor

@jorgemoya jorgemoya commented Apr 13, 2026

Linear: LTRAC-226

What/Why?

Wraps shared layout-level data-fetching functions in unstable_cache for guest (unauthenticated) visitors. This caches the return values server-side with a configurable revalidation interval, reducing redundant GraphQL calls for anonymous traffic.

Functions migrated:

  • getPageData (home page)
  • fetchRootLayoutMetadata (root layout)
  • getHeaderData, getHeaderLinks (header)
  • getFooterData, getFooterSections (footer)
  • getVanityUrl (SEO canonical)
  • getReCaptchaSettings (reCAPTCHA)

Authenticated requests continue to bypass the cache entirely (cache: 'no-store').

Third in a series of PRs splitting #2910. Depends on #2977.

Rollout/Rollback

No feature flag. Rollback is a simple revert. Cache revalidation interval is controlled by DEFAULT_REVALIDATE_TARGET env var (defaults to 3600s).

Testing

  • pnpm build passes
  • pnpm lint passes
  • Home page loads correctly for guest users (cached path)
  • Home page loads correctly for authenticated users (uncached path)
  • Header/footer navigation renders correctly
  • Canonical URLs resolve correctly

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: 63aafa4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@bigcommerce/catalyst-core Minor
@bigcommerce/catalyst-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Ready Ready Preview, Comment Apr 14, 2026 2:23pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Bundle Size Report

Comparing against baseline from a8dd99e (2026-04-14).

No bundle size changes detected.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Unlighthouse Performance Comparison — Vercel

Comparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores.

Summary Score

Aggregate score across all categories as reported by Unlighthouse.

Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Score 92 94 91 94

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 79 81 77 87
Accessibility 95 98 95 100
Best Practices 100 100 95 100
SEO 100 100 100 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.5 s 3.7 s 3.5 s 4.0 s
CLS 0.001 0.184 0 0
FCP 1.1 s 1.2 s 1.2 s 1.2 s
TBT 0 ms 0 ms 0 ms 0 ms
Max Potential FID 60 ms 40 ms 50 ms 60 ms
Time to Interactive 3.5 s 3.7 s 4.0 s 4.2 s

Full Unlighthouse report →

@jorgemoya jorgemoya force-pushed the LTRAC-226/guest-cache-layout branch from ed4e6ad to a45174e Compare April 13, 2026 19:17
@jorgemoya jorgemoya changed the title LTRAC-226: Wrap layout-level guest queries in unstable_cache LTRAC-226: feat(core): wrap layout-level guest queries in unstable_cache Apr 13, 2026
@jorgemoya jorgemoya changed the title LTRAC-226: feat(core): wrap layout-level guest queries in unstable_cache feat(core): wrap layout-level guest queries in unstable_cache Apr 13, 2026
@jorgemoya jorgemoya marked this pull request as ready for review April 13, 2026 19:53
@jorgemoya jorgemoya requested a review from a team as a code owner April 13, 2026 19:53
@jorgemoya jorgemoya force-pushed the LTRAC-226/guest-cache-layout branch from a45174e to f1f3c64 Compare April 13, 2026 19:59
@jorgemoya jorgemoya force-pushed the LTRAC-226/guest-cache-layout branch from f1f3c64 to 87c2826 Compare April 14, 2026 14:07
@jorgemoya jorgemoya force-pushed the LTRAC-226/guest-cache-layout branch from 87c2826 to 185ba5a Compare April 14, 2026 14:09
@jorgemoya jorgemoya force-pushed the LTRAC-226/guest-cache-layout branch from 185ba5a to bad2bf4 Compare April 14, 2026 14:17
jorgemoya and others added 2 commits April 14, 2026 09:21
…equest

Add optional locale parameter to client.fetch() for use in cached
contexts. Wrap headers() call in beforeRequest with try/catch so it
gracefully degrades inside unstable_cache.

No changes to getChannelId or beforeRequest callback signatures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wrap home page, header, footer, SEO canonical, reCAPTCHA, and root
layout metadata queries in unstable_cache for guest visitors.
Authenticated requests continue to bypass the cache with no-store.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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