Fix/i18n up breadcrumb locale race#2642
Merged
Merged
Conversation
Bug: The `up` (back/breadcrumb) link title is a Lingui `t` macro string, but it was constructed inline in the returned `props` object, after `await`ing the layout/page/config GraphQL queries. Lingui translates against a single global active-locale i18n instance, so a concurrent static-generation request for a different locale could call `i18n.activate()` during those awaits and cause the `t\`...\`` title to be rendered in the wrong language for the page being generated. Fix: Compute the `up` object (and its `t\`...\`` title) synchronously at the top of every affected `getStaticProps`, before any `await` yields control, so the translation is captured with the correct locale for the current request. Applied uniformly across the magento-graphcms, magento-open-source, and magento-storyblok example pages and the demo-magento-graphcommerce copy pages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 1dc4e9e The changes in this PR will be included in the next version bump. This PR includes changesets to release 86 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Bug: The
up(back/breadcrumb) link title is a Linguitmacro string,but it was constructed inline in the returned
propsobject, afterawaiting the layout/page/config GraphQL queries. Lingui translatesagainst a single global active-locale i18n instance, so a concurrent
static-generation request for a different locale could call
i18n.activate()during those awaits and cause thet\...`` title to berendered in the wrong language for the page being generated.
Fix: Compute the
upobject (and itst\...`title) synchronously at the top of every affectedgetStaticProps, before anyawait` yieldscontrol, so the translation is captured with the correct locale for the
current request. Applied uniformly across the magento-graphcms,
magento-open-source, and magento-storyblok example pages and the
demo-magento-graphcommerce copy pages.