fix: locale validation pvt routes#3364
Conversation
…utes
- Fix import in validateLocaleForHostname to use merged config
('discovery.config') instead of default-only config
('discovery.config.default.js'), consistent with all other utils
- Skip locale validation when localization.enabled is false,
consistent with bindingPaths.ts behavior
- Skip locale validation for /pvt/ routes (B2B portal pages
should not be subject to storefront locale validation)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ocalesSettings LocalesSettings type does not include enabled field — access it via storeConfig.localization?.enabled as done in bindingPaths.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WalkthroughThe PR adds two early-exit conditions for locale validation: bypassing validation when localization is disabled via ChangesLocalization Validation Gating
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
hellofanny
left a comment
There was a problem hiding this comment.
Approving! It's already merged on main
@lemagnetic taggin you just to let you know 😉

0 New Issues
0 Fixed Issues
0 Accepted Issues
Problem
validateLocaleForHostnamehas three bugs that cause 404 on all SSR pages when upgrading to FastStore v4:1. Wrong config import
The function imports from
discovery.config.default.js(FastStore default config only) instead ofdiscovery.config(merged default + store config). All other utils in the same codebase usediscovery.config.This means any locale bindings defined in the store's
discovery.config.jsare completely ignored during validation.2.
localization.enabledflag not respectedWhen
localization.enabled: false, the function still runs full hostname/binding validation and returnsnotFound: truefor any non-localhost host.All other functions in
bindingPaths.tscorrectly check!storeConfig.localization?.enabledand return early —validateLocaleForHostnamewas the only one missing this check.3.
/pvt/routes incorrectly validatedwithLocaleValidationSSRis applied to all SSR pages including B2B portal pages under/pvt/. These are private authenticated routes that have no relationship to storefront locale routing and should never be blocked by locale validation.Fix
discovery.config.default.js→discovery.configlocalization.enabledisfalse, consistent withbindingPaths.ts/pvt/Impact
Stores upgrading to v4 with
localization.enabled: false(the default) were getting 404 on all SSR pages (/pvt/account,/pvt/organization-account/..., etc.) in any non-localhost environment.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes