You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-06-25] [$250] [Sentry: APP-DTS] Web – Crash for Chrome 103 / Chrome OS users: Array.toReversed is not a function in MoneyRequestReportActionsList #91964
Version Number: 9.3.82-3 Reproducible in staging?: Yes Reproducible in production?: Yes Issue reported by: Internal Sentry investigation Sentry:https://expensify.sentry.io/issues/APP-DTS
Action Performed
Open any expense report in Search (route: /search)
View on Chrome 103 or an older Chromium-based browser (e.g. a managed Chrome OS device that hasn't updated past Chrome 110)
Expected Result
Expense report renders normally.
Actual Result
Full-page "Uh-oh, something went wrong!" ErrorBoundary crash screen. The app is completely unusable until the page is refreshed.
Workaround
Update Chrome / Chrome OS to a version that supports Array.prototype.toReversed() (Chrome 110+).
Platforms
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
Technical details
Array.prototype.toReversed() was added in Chrome 110 / Safari 16.4. Users on Chrome 103 (common in managed/enterprise Chrome OS environments that enforce a slower update cadence) don't have this method, so the call throws a TypeError during render which is caught by the ErrorBoundary.
🚨 Edited by proposal-police: This proposal was edited at 2026-05-28 16:14:48 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Chrome 103 / older Chromium (managed Chrome OS that hasn't updated past Chrome ~110), opening an expense report from /search throws TypeError: filteredActions.toReversed is not a function during render. The ErrorBoundary catches it and the user gets the full-page "Uh-oh, something went wrong!" crash until they refresh.
What is the root cause of that problem?
Array.prototype.toReversed() is part of the ES2023 "Change Array by Copy" group (Chrome 110 / Safari 16.4). On Chrome 103 the method is undefined, so the call at MoneyRequestReportActionsList.tsx#L176 throws synchronously inside the visibleReportActionsuseMemo → render fails → ErrorBoundary.
The deeper cause is a missing polyfill, not a single bad call. The app already supports these old browsers and already handles this exact incompatibility class:
src/setup/index.ts#L19 runs toSortedPolyfill.shim() (added in commit 3c18f5fac7e7f) — setup/index.ts is the designated polyfill home, also running intlPolyfill().
That shim exists specifically because AnnouncementSection.tsx#L11 calls .toSorted() — the sibling ES2023 method.
So .toSorted() is safe on Chrome 103, but .toReversed() (introduced later via PR #90680) was never given a matching shim. The two members of the same feature group were handled inconsistently — toReversed is the gap.
What changes do you think we should make in order to solve the problem?
Add the toReversed shim right next to the existing toSorted shim, mirroring the established pattern exactly (same es-shims family, same author).
1.package.json — add the dependency alongside the existing "array.prototype.tosorted":
No change at the call site — MoneyRequestReportActionsList.tsx#L176 keeps .toReversed() and is fixed globally, along with any future .toReversed() use.
Platforms: web/desktop. shim() only patches when the native method is absent, so it's a no-op on modern Chrome/Safari and on native (Hermes already has toReversed) — zero behavior change there.
Test plan
Chrome 103 (or run delete Array.prototype.toReversed in the console before load): open an expense report from /search → renders normally, no ErrorBoundary.
Confirm report actions still render newest-first (ordering preserved).
Modern Chrome: open the same report → no regression (shim is a no-op).
What alternative solutions did you explore? (Optional)
filteredActions.slice().reverse() at the call site (the issue's suggestion) — valid and dependency-free, but rejected because it patches only this one call site and diverges from the established toSorted shim convention; the next .toReversed() / .toSpliced() / .with() added anywhere would reintroduce the same Chrome 103 crash. The polyfill fixes the whole class at the boundary.
Broaden @babel/preset-env targets / add core-js to transpile-polyfill ES2023 globally — rejected: far larger blast radius and bundle cost for one missing method; the targeted es-shim matches the team's existing approach.
Add an ESLint rule banning .toReversed() — rejected: doesn't fix the existing crash by itself and fights the polyfill pattern already adopted for toSorted.
⚠️@yusufdeveloper2903 Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
Please re-state the problem that we are trying to solve in this issue.
When a user on Chrome/Chromium < 110 (or Safari < 16.4) — common on managed Chrome OS devices with a slow update cadence — opens an expense report in Search on Web, the app renders the full-page "Uh-oh, something went wrong!" ErrorBoundary crash and becomes unusable until refresh. Expected: the expense report renders normally regardless of browser version.
What is the root cause of that problem?
src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx:176 calls filteredActions.toReversed() inside the visibleReportActionsuseMemo. Array.prototype.toReversed() is an ES2023 method shipped only in Chrome 110 / Safari 16.4; on older engines it is undefined, so the call throws TypeError: ...toReversed is not a function during render, which the top-level ErrorBoundary catches and replaces with the crash screen. This is the only toReversed usage in src/.
What changes do you think we should make in order to solve the problem?
In src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx:176, replace return filteredActions.toReversed(); with return filteredActions.slice().reverse(); — produces the same new (non-mutating) reversed array, but uses only methods supported in every targeted browser.
No sibling/platform twins exist: grep confirms toReversed appears exactly once across src/, and this component has no .web/.native variants for this logic. The nearby visibleReportActions.at(-1) (line 192) and findLastIndex (line 399) are safe — both are supported since Chrome 92 / Safari 15.4, well below the failing versions.
What alternative solutions did you explore? (Optional)
Add a global Array.prototype.toReversed polyfill, but that broadens scope beyond this crash and a local non-mutating slice().reverse() is simpler and matches the existing call's semantics.
Chrome 103 and other Chromium-based browsers below 110 (still common in managed Chrome OS fleets) crash with TypeError: filteredActions.toReversed is not a function the moment they enter an expense report from /search, because the web bundle ships an un-transpiled Array.prototype.toReversed() call to a runtime that does not implement it.
Root cause
The crash is thrown from this useMemo body inside MoneyRequestReportActionsList.tsx:
// src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx:151-177// We are reversing actions because in this View we are starting at the top and don't use Inverted listconstvisibleReportActions=useMemo(()=>{constfilteredActions=reportActions.filter((reportAction)=>{// ...visibility / offline / IOU filters...returntrue;});returnfilteredActions.toReversed();},[reportActions,isOffline,canPerformWriteAction,reportTransactionIDs,shouldShowHarvestCreatedAction,visibleReportActionsData,reportID]);
Array.prototype.toReversed() is an ES2023 method that shipped in Chrome 110 / Safari 16.4 / Firefox 115. On Chrome 103 the method is undefined, so the invocation throws TypeError: filteredActions.toReversed is not a function inside the render-phase useMemo. React surfaces that into the nearest ErrorBoundary, producing the full-page "Uh-oh, something went wrong!" screen reported in Sentry (issue APP-DTS).
The reason this reaches users at all is the build configuration. babel.config.js:29 declares:
@babel/preset-env is targeted at Node 20, which natively supports toReversed(), so the preset emits no down-level transform for the call. There is no core-js / useBuiltIns polyfill chain in the web bundle either, so the method must exist on the runtime engine. For any browser older than Chrome 110 the call is therefore a hard crash. Re-targeting the browser baseline is out of scope for a single bounty (the rest of the app would need to be re-validated), so the correct fix is to stop relying on the ES2023 immutable-copy methods in source.
There is exactly one other production call site of the same ES2023 family — Array.prototype.toSorted() — which is also unsafe on Chrome 103 and worth patching in the same change:
This one runs at module-evaluation time on a non-empty array (see src/CONST/index.ts:10104+), so any Chrome 103 user who loads a chunk that imports AnnouncementSection will hit the same TypeError before the component even mounts. Confirmed by grepping the src/ tree — only these two production usages exist (tests/unit/* matches are Jest/Node-only and irrelevant):
src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx:176: return filteredActions.toReversed();
src/pages/home/AnnouncementSection.tsx:11:const announcements = CONST.HOME.ANNOUNCEMENTS.toSorted((a, b) => {
No toSpliced / Array.prototype.with calls exist in src/.
Proposed fix
1 - Replace toReversed() in MoneyRequestReportActionsList.tsx:
filteredActions is already a fresh array produced by Array.prototype.filter on line 153, so theoretically .reverse() alone would not mutate caller-owned state — but keeping the .slice() preserves the original immutable-copy semantics and matches the established pattern in the codebase (see precedent below), so future refactors that pass the result through additional pipelines stay safe.
2 - Replace toSorted() in AnnouncementSection.tsx:
The spread copy is required here because CONST.HOME.ANNOUNCEMENTS is a shared static array — a bare .sort() would mutate the constant in place and produce non-deterministic order on subsequent imports.
3 - Prevent future regressions with an ESLint rule (lightweight, optional but recommended in the same PR so a third occurrence cannot sneak in):
// .eslintrc.js — add to the existing `rules` block'no-restricted-syntax': ['error',{selector: "CallExpression[callee.property.name=/^(toReversed|toSorted|toSpliced)$/]",message: 'Array.prototype.toReversed/toSorted/toSpliced require Chrome 110+. Use [...arr].reverse()/sort()/splice() instead. See issue #91964.',},],
(If the maintainers prefer not to extend the lint config in the same PR, the two source-level changes above are sufficient to close the bounty.)
Why this approach
Precedent already exists in the codebase: src/pages/inbox/report/useActiveDraftReportAction.ts:33 deliberately uses the [...ancestors].slice().reverse() pattern rather than toReversed(), so the two replacements above bring the remaining stragglers in line with established style.
Alternatives that were considered and rejected:
Polyfilling via core-js would fix every call site but balloons the web bundle (core-js/es/array adds ~10 KB gzipped for methods we use exactly twice) and conflicts with the existing targets: {node: 20} posture in babel.config.js. Two one-line source edits cost nothing at runtime.
Bumping the @babel/preset-env target to defaults / > 0.5% would re-transpile the entire bundle and force a full QA pass on web, far outside the bounty scope, and would not have caught the AnnouncementSection module-load crash either (that one is in the same TC39 family).
Wrapping calls in a typeof Array.prototype.toReversed === 'function' runtime check keeps the modern API on capable browsers but adds branching at every call site for zero perf benefit, since .slice().reverse() is already an O(n) operation that V8 optimizes identically.
The two replacements are byte-for-byte equivalent in semantics (both return a new array, leave the source untouched, and use a stable in-place reverse/sort on a freshly-allocated copy) and unblock every Chrome 103 / managed Chrome OS user without touching the build pipeline.
Array.prototype.toReversed() is an ES2023 method only available in Chrome 110+ / Safari 16.4+. At MoneyRequestReportActionsList.tsx:176, the visibleReportActions useMemo calls filteredActions.toReversed(). On Chrome 103 (common in managed Chrome OS environments), this throws a TypeError during render, which propagates to the ErrorBoundary and crashes the entire page.
This is the only production call site — the other 4 usages of .toReversed() are in test files (hasNextActionMadeBySameActorTest.ts and isConsecutiveActionMadeByPreviousActorTest.ts) which run in Node/Jest and are unaffected.
What changes do you think we should make in order to solve the problem?
Replace filteredActions.toReversed() with filteredActions.slice().reverse() at MoneyRequestReportActionsList.tsx:176. slice() creates a shallow copy and reverse() mutates that copy in place — semantically identical to toReversed() but supported across all browsers.
What alternative solutions did you explore? (Optional)
A global polyfill for Array.prototype.toReversed (e.g. in src/setup/) would cover any future usages, but is unnecessary overhead for a single production call site and risks masking native implementations. The slice().reverse() pattern is the standard pre-ES2023 idiom and requires no additional dependencies.
Next Steps for Contributor+ team: To accept:@MelvinBot implement this to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
⚠️@wildan-m Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Activity
melvin-bot commentedon May 28, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)melvin-bot commentedon May 28, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022059992251751906051
yusufdeveloper2903 commentedon May 28, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-28 16:14:48 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Chrome 103 / older Chromium (managed Chrome OS that hasn't updated past Chrome ~110), opening an expense report from
/searchthrowsTypeError: filteredActions.toReversed is not a functionduring render. The ErrorBoundary catches it and the user gets the full-page "Uh-oh, something went wrong!" crash until they refresh.What is the root cause of that problem?
Array.prototype.toReversed()is part of the ES2023 "Change Array by Copy" group (Chrome 110 / Safari 16.4). On Chrome 103 the method isundefined, so the call atMoneyRequestReportActionsList.tsx#L176throws synchronously inside thevisibleReportActionsuseMemo→ render fails → ErrorBoundary.The deeper cause is a missing polyfill, not a single bad call. The app already supports these old browsers and already handles this exact incompatibility class:
src/setup/index.ts#L19runstoSortedPolyfill.shim()(added in commit3c18f5fac7e7f) —setup/index.tsis the designated polyfill home, also runningintlPolyfill().AnnouncementSection.tsx#L11calls.toSorted()— the sibling ES2023 method.So
.toSorted()is safe on Chrome 103, but.toReversed()(introduced later via PR #90680) was never given a matching shim. The two members of the same feature group were handled inconsistently —toReversedis the gap.What changes do you think we should make in order to solve the problem?
Add the
toReversedshim right next to the existingtoSortedshim, mirroring the established pattern exactly (same es-shims family, same author).1.
package.json— add the dependency alongside the existing"array.prototype.tosorted":2.
src/setup/index.ts— import and shim it next totoSorted:3.
src/types/modules/array.prototype.toreversed.d.ts(new) — mirrorarray.prototype.tosorted.d.ts:MoneyRequestReportActionsList.tsx#L176keeps.toReversed()and is fixed globally, along with any future.toReversed()use.package.json,package-lock.json,src/setup/index.ts,src/types/modules/array.prototype.toreversed.d.ts.shim()only patches when the native method is absent, so it's a no-op on modern Chrome/Safari and on native (Hermes already hastoReversed) — zero behavior change there.Test plan
delete Array.prototype.toReversedin the console before load): open an expense report from/search→ renders normally, no ErrorBoundary.What alternative solutions did you explore? (Optional)
filteredActions.slice().reverse()at the call site (the issue's suggestion) — valid and dependency-free, but rejected because it patches only this one call site and diverges from the establishedtoSortedshim convention; the next.toReversed()/.toSpliced()/.with()added anywhere would reintroduce the same Chrome 103 crash. The polyfill fixes the whole class at the boundary.@babel/preset-envtargets / addcore-jsto transpile-polyfill ES2023 globally — rejected: far larger blast radius and bundle cost for one missing method; the targeted es-shim matches the team's existing approach..toReversed()— rejected: doesn't fix the existing crash by itself and fights the polyfill pattern already adopted fortoSorted.github-actions commentedon May 28, 2026
aswin-s commentedon May 28, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user on Chrome/Chromium < 110 (or Safari < 16.4) — common on managed Chrome OS devices with a slow update cadence — opens an expense report in Search on Web, the app renders the full-page "Uh-oh, something went wrong!" ErrorBoundary crash and becomes unusable until refresh. Expected: the expense report renders normally regardless of browser version.
What is the root cause of that problem?
src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx:176callsfilteredActions.toReversed()inside thevisibleReportActionsuseMemo.Array.prototype.toReversed()is an ES2023 method shipped only in Chrome 110 / Safari 16.4; on older engines it isundefined, so the call throwsTypeError: ...toReversed is not a functionduring render, which the top-levelErrorBoundarycatches and replaces with the crash screen. This is the onlytoReversedusage insrc/.What changes do you think we should make in order to solve the problem?
src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx:176, replacereturn filteredActions.toReversed();withreturn filteredActions.slice().reverse();— produces the same new (non-mutating) reversed array, but uses only methods supported in every targeted browser.toReversedappears exactly once acrosssrc/, and this component has no.web/.nativevariants for this logic. The nearbyvisibleReportActions.at(-1)(line 192) andfindLastIndex(line 399) are safe — both are supported since Chrome 92 / Safari 15.4, well below the failing versions.What alternative solutions did you explore? (Optional)
Add a global
Array.prototype.toReversedpolyfill, but that broadens scope beyond this crash and a local non-mutatingslice().reverse()is simpler and matches the existing call's semantics.wildan-m commentedon May 28, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
trasnake87 commentedon May 28, 2026
Proposal
Chrome 103 and other Chromium-based browsers below 110 (still common in managed Chrome OS fleets) crash with
TypeError: filteredActions.toReversed is not a functionthe moment they enter an expense report from/search, because the web bundle ships an un-transpiledArray.prototype.toReversed()call to a runtime that does not implement it.Root cause
The crash is thrown from this
useMemobody insideMoneyRequestReportActionsList.tsx:Array.prototype.toReversed()is an ES2023 method that shipped in Chrome 110 / Safari 16.4 / Firefox 115. On Chrome 103 the method isundefined, so the invocation throwsTypeError: filteredActions.toReversed is not a functioninside the render-phaseuseMemo. React surfaces that into the nearestErrorBoundary, producing the full-page "Uh-oh, something went wrong!" screen reported in Sentry (issueAPP-DTS).The reason this reaches users at all is the build configuration.
babel.config.js:29declares:@babel/preset-envis targeted at Node 20, which natively supportstoReversed(), so the preset emits no down-level transform for the call. There is nocore-js/useBuiltInspolyfill chain in the web bundle either, so the method must exist on the runtime engine. For any browser older than Chrome 110 the call is therefore a hard crash. Re-targeting the browser baseline is out of scope for a single bounty (the rest of the app would need to be re-validated), so the correct fix is to stop relying on the ES2023 immutable-copy methods in source.There is exactly one other production call site of the same ES2023 family —
Array.prototype.toSorted()— which is also unsafe on Chrome 103 and worth patching in the same change:This one runs at module-evaluation time on a non-empty array (see
src/CONST/index.ts:10104+), so any Chrome 103 user who loads a chunk that importsAnnouncementSectionwill hit the sameTypeErrorbefore the component even mounts. Confirmed by grepping thesrc/tree — only these two production usages exist (tests/unit/*matches are Jest/Node-only and irrelevant):No
toSpliced/Array.prototype.withcalls exist insrc/.Proposed fix
1 - Replace
toReversed()inMoneyRequestReportActionsList.tsx:filteredActionsis already a fresh array produced byArray.prototype.filteron line 153, so theoretically.reverse()alone would not mutate caller-owned state — but keeping the.slice()preserves the original immutable-copy semantics and matches the established pattern in the codebase (see precedent below), so future refactors that pass the result through additional pipelines stay safe.2 - Replace
toSorted()inAnnouncementSection.tsx:The spread copy is required here because
CONST.HOME.ANNOUNCEMENTSis a shared static array — a bare.sort()would mutate the constant in place and produce non-deterministic order on subsequent imports.3 - Prevent future regressions with an ESLint rule (lightweight, optional but recommended in the same PR so a third occurrence cannot sneak in):
(If the maintainers prefer not to extend the lint config in the same PR, the two source-level changes above are sufficient to close the bounty.)
Why this approach
Precedent already exists in the codebase:
src/pages/inbox/report/useActiveDraftReportAction.ts:33deliberately uses the[...ancestors].slice().reverse()pattern rather thantoReversed(), so the two replacements above bring the remaining stragglers in line with established style.Alternatives that were considered and rejected:
core-jswould fix every call site but balloons the web bundle (core-js/es/arrayadds ~10 KB gzipped for methods we use exactly twice) and conflicts with the existingtargets: {node: 20}posture inbabel.config.js. Two one-line source edits cost nothing at runtime.@babel/preset-envtarget todefaults/> 0.5%would re-transpile the entire bundle and force a full QA pass on web, far outside the bounty scope, and would not have caught theAnnouncementSectionmodule-load crash either (that one is in the same TC39 family).typeof Array.prototype.toReversed === 'function'runtime check keeps the modern API on capable browsers but adds branching at every call site for zero perf benefit, since.slice().reverse()is already an O(n) operation that V8 optimizes identically.The two replacements are byte-for-byte equivalent in semantics (both return a new array, leave the source untouched, and use a stable in-place reverse/sort on a freshly-allocated copy) and unblock every Chrome 103 / managed Chrome OS user without touching the build pipeline.
MelvinBot commentedon May 28, 2026
Proposal
What is the root cause of that problem?
Array.prototype.toReversed()is an ES2023 method only available in Chrome 110+ / Safari 16.4+. AtMoneyRequestReportActionsList.tsx:176, thevisibleReportActionsuseMemo callsfilteredActions.toReversed(). On Chrome 103 (common in managed Chrome OS environments), this throws aTypeErrorduring render, which propagates to the ErrorBoundary and crashes the entire page.This is the only production call site — the other 4 usages of
.toReversed()are in test files (hasNextActionMadeBySameActorTest.tsandisConsecutiveActionMadeByPreviousActorTest.ts) which run in Node/Jest and are unaffected.What changes do you think we should make in order to solve the problem?
Replace
filteredActions.toReversed()withfilteredActions.slice().reverse()atMoneyRequestReportActionsList.tsx:176.slice()creates a shallow copy andreverse()mutates that copy in place — semantically identical totoReversed()but supported across all browsers.What alternative solutions did you explore? (Optional)
A global polyfill for
Array.prototype.toReversed(e.g. insrc/setup/) would cover any future usages, but is unnecessary overhead for a single production call site and risks masking native implementations. Theslice().reverse()pattern is the standard pre-ES2023 idiom and requires no additional dependencies.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement thisto create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
github-actions commentedon May 28, 2026
57 remaining items
melvin-bot commentedon Jun 24, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jun 24, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
eh2077 commentedon Jun 25, 2026
@mallenexpensify checklist is here #91964 (comment), thx!
mallenexpensify commentedon Jun 27, 2026
Payment Summary
Contributor+: @eh2077 due $250 via NewDot
laurenreidexpensify commentedon Aug 4, 2026
$250 approved @eh2077