From 4a59ecf409c19099989bac1f390a92734fdc924e Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 25 Jul 2025 12:08:13 +0800 Subject: [PATCH] fix number format polyfill isn't applied --- src/libs/NumberFormatUtils/index.ts | 5 +++-- src/libs/NumberFormatUtils/intlPolyfill.ios.ts | 10 ---------- src/libs/NumberFormatUtils/intlPolyfill.ts | 2 -- src/setup/index.ts | 4 ---- 4 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 src/libs/NumberFormatUtils/intlPolyfill.ios.ts delete mode 100644 src/libs/NumberFormatUtils/intlPolyfill.ts diff --git a/src/libs/NumberFormatUtils/index.ts b/src/libs/NumberFormatUtils/index.ts index 02bb14b29eed..cf04fa6eca56 100644 --- a/src/libs/NumberFormatUtils/index.ts +++ b/src/libs/NumberFormatUtils/index.ts @@ -1,9 +1,10 @@ +import intlPolyfill from '@libs/IntlPolyfill'; import memoize from '@libs/memoize'; import CONST from '@src/CONST'; import type Locale from '@src/types/onyx/Locale'; -import initPolyfill from './intlPolyfill'; -initPolyfill(); +// Polyfill the Intl API if locale data is not as expected +intlPolyfill(); const MemoizedNumberFormat = memoize(Intl.NumberFormat, {maxSize: 10, monitoringName: 'NumberFormatUtils'}); diff --git a/src/libs/NumberFormatUtils/intlPolyfill.ios.ts b/src/libs/NumberFormatUtils/intlPolyfill.ios.ts deleted file mode 100644 index 4745284c0b61..000000000000 --- a/src/libs/NumberFormatUtils/intlPolyfill.ios.ts +++ /dev/null @@ -1,10 +0,0 @@ -import intlPolyfill from '@libs/IntlPolyfill'; - -// On iOS, polyfills from `additionalSetup` are applied after memoization, which results in incorrect cache entry of `Intl.NumberFormat` (e.g. lacking `formatToParts` method). -// To fix this, we need to apply the polyfill manually before memoization. -// For further information, see: https://github.com/Expensify/App/pull/43868#issuecomment-2217637217 -const initPolyfill = () => { - intlPolyfill(); -}; - -export default initPolyfill; diff --git a/src/libs/NumberFormatUtils/intlPolyfill.ts b/src/libs/NumberFormatUtils/intlPolyfill.ts deleted file mode 100644 index 31fedd6a01b6..000000000000 --- a/src/libs/NumberFormatUtils/intlPolyfill.ts +++ /dev/null @@ -1,2 +0,0 @@ -const initPolyfill = () => {}; -export default initPolyfill; diff --git a/src/setup/index.ts b/src/setup/index.ts index 8c5a32ea170f..6a0e2c4413c3 100644 --- a/src/setup/index.ts +++ b/src/setup/index.ts @@ -1,6 +1,5 @@ import {I18nManager} from 'react-native'; import Onyx from 'react-native-onyx'; -import intlPolyfill from '@libs/IntlPolyfill'; import {setDeviceID} from '@userActions/Device'; import initLocale from '@userActions/Locale'; import initOnyxDerivedValues from '@userActions/OnyxDerived'; @@ -64,9 +63,6 @@ export default function () { I18nManager.allowRTL(false); I18nManager.forceRTL(false); - // Polyfill the Intl API if locale data is not as expected - intlPolyfill(); - // Perform any other platform-specific setup platformSetup();