fix(mobile): polyfill Intl.PluralRules on Hermes - #5499
Merged
Conversation
Fixes KILO-APP-5S Hermes ships without Intl.PluralRules. The FormatJS NumberFormat polyfill constructs one, so every formatNumber call on a device threw "undefined is not a function" and the tabs layout crashed at startup. Load the PluralRules polyfill and its locale data before the NumberFormat polyfill. The Hermes test no longer stubs PluralRules as present.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous Review Summary (commit 8927752)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 8927752)Status: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by grok-4.6 · Input: 111.6K · Output: 15.6K · Cached: 525.6K Review guidance: REVIEW.md from base branch |
pandemicsyn
approved these changes
Aug 25, 2026
i18next builds its own Intl.PluralRules per language and caches the result. If the polyfill is not in place before the first render in the new language, it caches the English one/other fallback for that language. Run prewarmIntl before changeLanguage at both call sites. Add a test that stubs the real Hermes Intl surface and exercises every formatter for every supported language, plus i18next plural selection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes KILO-APP-5S: TestFlight build 1.0.6 (156) crashes at startup with
Error: undefined is not a function.Intl.PluralRules. The FormatJS NumberFormat polyfill callsnew Intl.PluralRules(...), so the firstformatNumbercall (tab accessibility labels inTabsLayout) threw.@formatjs/intl-pluralrulesand load it, with locale data, before the NumberFormat polyfill.Intl.PluralRulesper language and caches the English one/other fallback when it is missing. RunprewarmIntlbeforechangeLanguageat both call sites so the polyfill is in place first.main.Hermes audit
Grepped
apps/mobile/srcandpackages/app-sharedfor features Hermes lacks (structuredClone,Object.groupBy, Set methods, iterator helpers,toSorted, RegExpd/vflags,Intl.DisplayNames/Locale/Segmenterdirect use). No other hits in app code. EveryIntlconstructor routes throughintl-cache.ts.Test plan
pnpm typecheck && pnpm lint && pnpm check:unused && pnpm testinapps/mobile