Skip to content

perf(bootstrap): Parallelize locale and moment chunk fetches#115727

Merged
JonasBa merged 5 commits into
masterfrom
perf/parallelize-locale-initialization
May 18, 2026
Merged

perf(bootstrap): Parallelize locale and moment chunk fetches#115727
JonasBa merged 5 commits into
masterfrom
perf/parallelize-locale-initialization

Conversation

@JonasBa
Copy link
Copy Markdown
Member

@JonasBa JonasBa commented May 18, 2026

Parallelize translation async resources for non english users (we don't need to fetch them sequentially)

For non-English users, the translation .po file and the moment locale
chunk were fetched sequentially. These are independent network requests,
so fetch them in parallel with Promise.all to remove one waterfall from
the boot path.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 18, 2026
@JonasBa JonasBa marked this pull request as ready for review May 18, 2026 16:12
@JonasBa JonasBa requested a review from a team as a code owner May 18, 2026 16:12
Comment thread static/app/bootstrap/initializeLocale.tsx
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.54% 93.54% ±0%
Typed 135,457 135,458 🟢 +1
Untyped 9,353 9,354 🔴 +1
🔍 1 new type safety issue introduced

any-typed symbols (1 new)

File Line Detail
static/app/bootstrap/initializeLocale.tsx 73 translations (var(binding))

This is informational only and does not block the PR.

Comment thread static/app/bootstrap/initializeLocale.tsx
Catch errors from moment locale imports to ensure setLocale is always
called with translations, even if the moment locale doesn't exist.
This prevents non-English users from losing all translations when
their moment locale fails to load.

Co-authored-by: Jonas <JonasBa@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3f1ee54. Configure here.

Comment thread static/app/bootstrap/initializeLocale.tsx
Use explicit .then() and .catch() handlers on the entire Promise.all
chain to guard against any errors. This ensures setLocale is always
called - either with translations on success, or with DEFAULT_LOCALE_DATA
on failure. Also adds DEFAULT_LOCALE_DATA fallback in the outer catch
block to prevent app initialization failure.

Co-authored-by: Jonas <JonasBa@users.noreply.github.com>
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Not blocking but I don't think we need both fallbacks?

Comment thread static/app/bootstrap/initializeLocale.tsx Outdated
Comment thread static/app/bootstrap/initializeLocale.tsx Outdated
The moment locale import rejection was propagating through Promise.all,
causing successfully fetched translations to be discarded in the catch
handler. Handle the moment import failure independently so setLocale is
always called with the correct translations.

Co-Authored-By: Claude <noreply@anthropic.com>
@JonasBa JonasBa merged commit cfb3f3d into master May 18, 2026
75 checks passed
@JonasBa JonasBa deleted the perf/parallelize-locale-initialization branch May 18, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants