Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/resources/polyfills/intl-polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const polyfillIntl = async () => {
await import("@formatjs/intl-getcanonicallocales/polyfill-force");
}
if (shouldPolyfillLocale()) {
await import("@formatjs/intl-locale/polyfill-force");
import("@formatjs/intl-locale/polyfill-force");
Copy link

Copilot AI Jan 3, 2026

Choose a reason for hiding this comment

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

This fire-and-forget import has no error handling and its result is ignored. If the polyfill import fails silently, it could cause runtime errors when the Intl.Locale API is used. Additionally, there's no guarantee this polyfill will load before the application tries to use the Intl.Locale API, potentially causing race conditions.

Suggested change
import("@formatjs/intl-locale/polyfill-force");
polyfills.push(import("@formatjs/intl-locale/polyfill-force"));

Copilot uses AI. Check for mistakes.
}
if (shouldPolyfillDateTimeFormat(locale)) {
polyfills.push(
Expand Down Expand Up @@ -66,10 +66,10 @@ const polyfillIntl = async () => {
if (polyfills.length === 0) {
return;
}
await Promise.allSettled(polyfills).then(() =>
Promise.all(polyfills).then(async () => {
// Load the default language
polyfillLocaleData(locale)
);
await polyfillLocaleData(locale);
});
Copy link

Copilot AI Jan 3, 2026

Choose a reason for hiding this comment

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

The Promise.all result is not awaited, which breaks the async flow of polyfillIntl(). The function will return immediately (line 75 has 'await polyfillIntl()'), but the polyfills won't be loaded yet. This creates a race condition where polyfillLocaleData may execute before the polyfills it depends on are loaded, causing the locale data loading to fail or be skipped since the polyfill __addLocaleData functions won't be available yet.

Copilot uses AI. Check for mistakes.
};

await polyfillIntl();
Loading