Skip to content

feat(core): make locale required on client.fetch()#2982

Draft
jorgemoya wants to merge 7 commits intocanaryfrom
LTRAC-226/locale-required
Draft

feat(core): make locale required on client.fetch()#2982
jorgemoya wants to merge 7 commits intocanaryfrom
LTRAC-226/locale-required

Conversation

@jorgemoya
Copy link
Copy Markdown
Contributor

@jorgemoya jorgemoya commented Apr 13, 2026

Linear: LTRAC-226

What/Why?

Makes locale a required parameter on client.fetch() instead of optional. This ensures every fetch call explicitly provides locale for correct channel resolution and Accept-Language header, preventing silent fallback failures inside unstable_cache where getLocale() is unavailable.

67 files updated across server actions, page-data functions, auth, cart utilities, analytics, components, and route handlers. Build-time contexts (next.config.ts, robots.txt, favicon.ico) and proxies pass '' as locale since no request context is available there.

Final PR in the series splitting #2910. Depends on #2981.

Rollout/Rollback

Breaking change for @bigcommerce/catalyst-client consumers — locale is now required on client.fetch(). Rollback is a simple revert.

Testing

  • tsc --noEmit passes with 0 errors
  • pnpm lint passes
  • All pages load correctly for guest and authenticated users
  • Server actions (cart, account, auth, wishlists) function correctly
  • Multi-locale storefronts resolve correct channel and language

🤖 Generated with Claude Code

@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:24pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: 45e611b

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 Minor

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

@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.

@jorgemoya jorgemoya changed the title LTRAC-226: Make locale required on client.fetch() LTRAC-226: feat(core): make locale required on client.fetch() Apr 13, 2026
@jorgemoya jorgemoya changed the title LTRAC-226: feat(core): make locale required on client.fetch() feat(core): make locale required on client.fetch() Apr 13, 2026
@jorgemoya jorgemoya force-pushed the LTRAC-226/locale-required branch from 212cd68 to e96f4d8 Compare April 13, 2026 20:00
@jorgemoya jorgemoya force-pushed the LTRAC-226/locale-required branch from e96f4d8 to d921023 Compare April 13, 2026 20:05
@jorgemoya jorgemoya force-pushed the LTRAC-226/locale-required branch from d921023 to e292d4e Compare April 14, 2026 14:07
@jorgemoya jorgemoya force-pushed the LTRAC-226/locale-required branch from e292d4e to 36bd51c Compare April 14, 2026 14:10
@jorgemoya jorgemoya force-pushed the LTRAC-226/locale-required branch from 36bd51c to 8a54949 Compare April 14, 2026 14:18
@jorgemoya jorgemoya force-pushed the LTRAC-226/locale-required branch from 8a54949 to b7bbcd7 Compare April 14, 2026 14:20
jorgemoya and others added 7 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>
Wrap product details, pricing, inventory, variant inventory, related
products, inventory settings, and reviews queries in unstable_cache
for guest visitors. Authenticated requests bypass the cache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…_cache

Wrap brand, category, search, compare, and quick search queries in
unstable_cache for guest visitors. Faceted search uses 300s revalidation;
others use the default interval. Authenticated requests bypass the cache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wrap blog, web pages, gift certificates, public wishlist, change
password, and shipping countries queries in unstable_cache for guest
visitors. This completes the guest query caching migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Make the locale parameter required (not optional) on client.fetch()
to ensure correct channel resolution and Accept-Language header in
all contexts, including inside unstable_cache where getLocale() is
unavailable.

All call sites now explicitly pass locale. Build-time contexts
(next.config.ts, robots.txt, favicon.ico) and proxies pass an empty
string as locale since no request context is available.

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