-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Don't await intl-polyfill imports #28779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"); | ||
| } | ||
| if (shouldPolyfillDateTimeFormat(locale)) { | ||
| polyfills.push( | ||
|
|
@@ -66,10 +66,10 @@ const polyfillIntl = async () => { | |
| if (polyfills.length === 0) { | ||
| return; | ||
| } | ||
| await Promise.allSettled(polyfills).then(() => | ||
| Promise.all(polyfills).then(async () => { | ||
farmio marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // Load the default language | ||
| polyfillLocaleData(locale) | ||
| ); | ||
| await polyfillLocaleData(locale); | ||
| }); | ||
|
||
| }; | ||
|
|
||
| await polyfillIntl(); | ||
There was a problem hiding this comment.
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.