Skip to content

Conversation

@farmio
Copy link
Contributor

@farmio farmio commented Jan 3, 2026

Proposed change

Awaiting import("@formatjs/intl-displaynames/polyfill-force"); in Chrome 143 on macOS 15.6.1 never resolves and dosen't log anything when loading it as part of a config panel dependency (submodule of https://github.com/XKNX/knx-frontend). The project just doesn't load then - an empty tag is rendered instead of the panel.

This started with f2aba45
Removing await here fixes this for me.

Unfortunately I can't explain why this is happening or what exactly is going on here - and I would be happy if anyone would tell me 😃

For polyfillLocaleData(locale) - afaict - it doesn't make a difference if awaited or not. Both work fine.

Testing await import("@formatjs/intl-locale/polyfill-force"); - although it wouldn't load for my version of Chrome, removing the if-check it would also block indefinitely when using await.
await import("@formatjs/intl-getcanonicallocales/polyfill-force"); works fine.

See also https://discord.com/channels/330944238910963714/1456944554786816154

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to fix an issue where await import("@formatjs/intl-displaynames/polyfill-force") hangs indefinitely in Chrome 143 on macOS when loaded as part of a config panel dependency. The proposed solution removes await keywords from polyfill imports to prevent the blocking behavior.

Key changes:

  • Remove await from intl-locale polyfill import (line 32)
  • Change from await Promise.allSettled() to non-awaited Promise.all() (line 69)
  • Add await to polyfillLocaleData() call inside the promise chain (line 71)

}
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.
Comment on lines 69 to 72
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.
@bramkragten bramkragten added this to the 2026.1 milestone Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants