Description
When submitting an expense on the confirmation page, the app crashes with TypeError: t is not iterable if policyRecentlyUsedCurrencies has not been hydrated by Onyx yet (i.e. is undefined or null).
The crash occurs in mergePolicyRecentlyUsedCurrencies at src/libs/actions/IOU/index.ts:3795 when attempting to spread policyRecentlyUsedCurrencies into an array:
const currenciesWithNew = [currency, ...policyRecentlyUsedCurrencies];
The sibling function mergePolicyRecentlyUsedCategories already has a defensive Array.isArray() check, but mergePolicyRecentlyUsedCurrencies does not.
Sentry Issues
Both share the same stacktrace through IOURequestStepConfirmation → requestMoney → getMoneyRequestInformation → mergePolicyRecentlyUsedCurrencies.
Expected Behavior
Expense submission should succeed even when policyRecentlyUsedCurrencies hasn't been hydrated from Onyx yet.
Actual Behavior
App crashes with TypeError: t is not iterable, blocking the user from submitting the expense.
Proposed Fix
Add the same Array.isArray() defensive check used in mergePolicyRecentlyUsedCategories:
const currenciesArray = Array.isArray(policyRecentlyUsedCurrencies) ? policyRecentlyUsedCurrencies : [];