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
[$175] Android – App crashes when opening a transaction from a report preview after restarting the app. #105394
Version Number: 9.5.25-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@dmkt9 Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Open the Android app.
Navigate to a workspace chat containing a report with at least two transactions.
Fully close the app.
Reopen the app.
Once the app has fully loaded, tap the report preview to open a transaction.
Expected Result:
The transaction report opens successfully.
Actual Result:
The app crashes.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
if (contextMenuRef.current?.isContextMenuOpening) {
return;
}It looks like contextMenuRef.current changes from a value → null → a value during hydration, so it may become null after the null check.
When I capture the ref in a local variable instead, the crash disappears:
const contextMenu = contextMenuRef.current;
if (contextMenu?.isContextMenuOpening) {
return;
}
⚠️Preliminary analysis (low confidence) — treat as a starting point, not a conclusion.
I think the crash happens on the screen the tap opens, not in the tap handler. After a restart, the expense report's IOU action isn't in Onyx yet. So openTransactionFromPreview does three things at once:
Writes a bare-bones transaction thread with no parentReportActionID (resolveChildReportID).
The destination lists then mount and change type while data is still loading. On Android, a likely failure point is the native scroll manager. Its scrollToIndex has no range or layout guard (useReportScrollManager/index.native.ts:13-31).
I wasn't able to verify this. The issue has no stack trace, and I can't run the Android app here. The tap path itself has no throw, non-null assertion, or unguarded scrollToIndex.
To confirm, check:
The Android logcat or Sentry stack for this crash. It shows whether this is a JS fatal or a native crash (react-native-screens or FlashList).
Whether it still crashes if you open the expense report once before restarting. If it doesn't, the missing IOU action is the trigger.
Fix action pill flashing when sending messages changed the native-only scroll manager and briefly dropped the optional call on getNativeScrollRef. A later PR restored it on 10-29. Worth retesting on a build that includes that PR.
changed the title [-]Android – App crashes when opening a transaction from a report preview after restarting the app.[/-][+][$175] Android – App crashes when opening a transaction from a report preview after restarting the app.[/+]on Oct 29, 2026
Please re-state the problem that we are trying to solve in this issue.
On Android, after force-closing and reopening the app in a workspace chat that contains an expense report with multiple transactions, tapping a transaction card inside the report preview crashes the app instead of opening the transaction thread report.
What is the root cause of that problem?
There are two parts to why this happens during cold-start hydration on Android:
Why contextMenuRef.current repeatedly flips value -> null -> value during hydration:
In src/GlobalModals.tsx:31-62, LazyPopoverReportActionContextMenu is mounted with ref={ReportActionContextMenu.contextMenuRef}. Inside src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx:64-105 and 348-388, PopoverReportActionContextMenu subscribes to several global Onyx collections (ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS, ONYXKEYS.BANK_ACCOUNT_LIST, ONYXKEYS.SELF_DM_REPORT_ID, etc.) and is skipped by React Compiler because it reads reportIDRef.current and reportActionRef.current during render.
At src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx:500-512, useImperativeHandle(ref, () => ({ ... })) is called without a dependency array. In React's commit phase, whenever an effectful useImperativeHandle without stable dependencies re-runs on a render, React first detaches the ref in the mutation phase (safelyDetachRef sets contextMenuRef.current = null) before attaching the newly created handle object in the layout phase (commitAttachRef). Because cold-start hydration after an app restart triggers a stream of Onyx updates across those global subscriptions, contextMenuRef.current repeatedly cycles value -> null -> value.
Why MoneyRequestReportPreview crashes on press:
In src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts, all other consumers interact with contextMenuRef through helper functions, whereas src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx directly accesses contextMenuRef.current?.isContextMenuOpening in openReportFromPreview (line 174) and openTransactionFromPreview (line 333). After PR [No QA] Disallow manual memoization in compiled React code #104522 removed manual useCallback memoization in MoneyRequestReportPreview/index.tsx so it is compiled by React Compiler (and lowered through cjs-inline-requires-loader.mjs on native), evaluating contextMenuRef.current?.isContextMenuOpening directly on the imported binding during cold-start hydration crashes on Android unless contextMenuRef.current is captured in a local variable first.
What changes do you think we should make in order to solve the problem?
In src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx, capture const contextMenu = contextMenuRef.current; in a local variable before checking contextMenu?.isContextMenuOpening in both openReportFromPreview (lines 173-176) and openTransactionFromPreview (lines 332-335):
(Alternatively, we can export a small helper function isContextMenuOpening(): boolean from src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts that captures const contextMenu = contextMenuRef.current; return !!contextMenu?.isContextMenuOpening; and call isContextMenuOpening() in both handlers so MoneyRequestReportPreview does not need to touch contextMenuRef.current directly.)
Optionally, to stop contextMenuRef.current from detaching to null on every background render of PopoverReportActionContextMenu when the popover is closed, we can also store isContextMenuOpening in a ref (or keep the imperative handle methods reading from refs with a stable useImperativeHandle(ref, () => ({ ... }), [ ... ])) in src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx, since isContextMenuOpening is never read in JSX.
What alternative solutions did you explore? (Optional)
Waiting for contextMenuRef.current to be non-null before allowing preview presses would block opening reports/transactions during the initial 2-second idle deferral window (IDLE_CALLBACK_TIMEOUT_MS in GlobalModals.tsx) when the context menu has not even been mounted yet. Capturing const contextMenu = contextMenuRef.current locally in openReportFromPreview and openTransactionFromPreview safely treats an unmounted or mid-commit ref as not opening while avoiding the Android crash.
Please re-state the problem that we are trying to solve in this issue.
On Android, after force-closing and restarting the app in a workspace chat that contains an expense report with multiple transactions, tapping a transaction card in the report preview causes the app to crash instead of opening the transaction thread report.
What is the root cause of that problem?
There are three interrelated architectural and lifecycle factors causing this crash on Android:
Direct ref de-referencing bypassing encapsulation:
Across the application, contextMenuRef in src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts is strictly encapsulated behind exported helper functions (showContextMenu, hideContextMenu, isActiveReportAction, clearActiveReportAction, showDeleteModal, hideDeleteModal). Each of these helpers guards access to the underlying ref.
However, src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx was the sole exception in the entire codebase, importing contextMenuRef directly and evaluating contextMenuRef.current?.isContextMenuOpening inline in openReportFromPreview (line 184) and openTransactionFromPreview (line 349).
Un-memoized useImperativeHandle causing ref.current detachment during Onyx hydration:
In src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx:501-513, useImperativeHandle(ref, () => ({ ... })) is declared without any dependency array. PopoverReportActionContextMenu subscribes to several global Onyx collections (ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS, ONYXKEYS.COLLECTION.REPORT_ACTIONS, etc.).
During cold-start hydration following an app restart, initial data sequentially hydrates across these subscriptions, triggering multiple successive re-renders of PopoverReportActionContextMenu. Because useImperativeHandle lacks dependencies, React commits cleanup on each render—setting ref.current = null in the mutation phase before attaching the newly created imperative handle in the layout phase. This causes contextMenuRef.current to cycle value -> null -> value.
Android Hermes runtime crash on unmemoized member de-referencing:
Under React Native Android with Hermes, React Compiler, and inline module requires (cjs-inline-requires-loader.mjs), evaluating contextMenuRef.current?.isContextMenuOpening directly across the imported module binding while the ref is in transition or unattached leads to accessing properties on an uninitialized/null reference, terminating the process with a fatal native crash ("Expensify keeps stopping").
What changes do you think we should make in order to solve the problem?
1. Export isContextMenuOpening helper from ReportActionContextMenu.ts
--- a/src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts+++ b/src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts@@ -191,8 +191,16 @@ function clearActiveReportAction() {
return contextMenuRef.current.clearActiveReportAction();
}
-export {contextMenuRef, showContextMenu, hideContextMenu, isActiveReportAction, clearActiveReportAction, showDeleteModal, hideDeleteModal, registerEnsureContextMenuMounted};+/**+ * Whether the context menu is currently opening.+ */+function isContextMenuOpening(): boolean {+ const contextMenu = contextMenuRef.current;+ return !!contextMenu?.isContextMenuOpening;+}++export {contextMenuRef, showContextMenu, hideContextMenu, isActiveReportAction, clearActiveReportAction, showDeleteModal, hideDeleteModal, registerEnsureContextMenuMounted, isContextMenuOpening};
export type {ContextMenuType, ReportActionContextMenu, ContextMenuAnchor};
Capturing contextMenuRef.current in a local variable (const contextMenu = contextMenuRef.current) ensures the ref is read exactly once in a single evaluation step.
2. Update MoneyRequestReportPreview/index.tsx to consume isContextMenuOpening
What alternative solutions did you explore? (Optional)
Capturing const contextMenu = contextMenuRef.current; locally inside MoneyRequestReportPreview: While locally capturing the ref stops the crash, leaving contextMenuRef exposed violates the component architecture of ReportActionContextMenu, where all callers interact through exported helper functions. Providing isContextMenuOpening() encapsulates the ref correctly across the codebase.
Waiting for contextMenuRef.current to be defined before allowing preview taps: This would introduce an artificial 2-second touch block during the idle deferral window (IDLE_CALLBACK_TIMEOUT_MS in GlobalModals.tsx) when the context menu is still lazily idle-deferred. Calling isContextMenuOpening() handles unmounted, null, or opening states cleanly with zero interaction latency.
What automated tests can you add to prevent this from re-occurring?
Add unit tests in tests/ui/MoneyRequestReportPreview.test.tsx verifying:
openTransactionFromPreview executes cleanly when contextMenuRef.current is null (simulating cold-start pre-hydration state).
openTransactionFromPreview safely executes when contextMenuRef.current transitions during mount.
isContextMenuOpening() returns false when contextMenuRef.current is null without throwing any runtime error.
Please re-state the problem that we are trying to solve in this issue.
On Android, after force-closing and reopening the app in a workspace chat that contains an expense report with multiple transactions, tapping a transaction card in the report preview crashes the app instead of opening the transaction thread report.
What is the root cause of that problem?
In src/GlobalModals.tsx, LazyPopoverReportActionContextMenu is mounted with
ef={ReportActionContextMenu.contextMenuRef}. Inside src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx (lines 500-512), useImperativeHandle(ref, () => ({ ... })) is declared without a dependency array while the component subscribes to multiple global Onyx collections (TRANSACTION_VIOLATIONS, VISIBLE_REPORT_ACTIONS, BANK_ACCOUNT_LIST, etc.). During cold-start Onyx hydration after an app restart, each render detaches contextMenuRef.current = null in React's mutation phase before re-attaching the new handle in the layout phase.
Unlike every other consumer of src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts (which uses encapsulated helper functions), src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx imports contextMenuRef directly and evaluates contextMenuRef.current?.isContextMenuOpening in openReportFromPreview and openTransactionFromPreview. After PR [No QA] Disallow manual memoization in compiled React code #104522 enabled React Compiler on MoneyRequestReportPreview/index.tsx (combined with cjs-inline-requires-loader.mjs on Android Hermes), reading .current?.isContextMenuOpening directly across the inline-required module binding while contextMenuRef.current transitions �alue -> null -> value during cold-start hydration triggers a fatal Android crash unless captured in a local variable / helper function.
What changes do you think we should make in order to solve the problem?
In src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts, export a dedicated helper function isContextMenuOpening(): boolean that captures const contextMenu = contextMenuRef.current; return !!contextMenu?.isContextMenuOpening;.
In src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx, replace the direct contextMenuRef.current?.isContextMenuOpening checks in both openReportFromPreview and openTransactionFromPreview with isContextMenuOpening() (or capture const contextMenu = contextMenuRef.current; locally before checking contextMenu?.isContextMenuOpening).
In src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx, stabilize useImperativeHandle so background Onyx hydration renders while the context menu is closed do not repeatedly detach and re-attach contextMenuRef.current.
What alternative solutions did you explore? (Optional)
Blocking preview presses when contextMenuRef.current is
ull was ruled out because GlobalModals.tsx defers mounting LazyPopoverReportActionContextMenu via
equestIdleCallback (IDLE_CALLBACK_TIMEOUT_MS = 2000), so contextMenuRef.current is legitimately
ull right after startup. Capturing the ref via isContextMenuOpening() safely returns alse when unmounted or mid-hydration without blocking user taps.
(Vit's agent) Sentry tracks this crash as APP-NHA. Fresh numbers:
Users (last 14d, production 9.5.25 to 9.5.27): 7 (9.5.25: 5, 9.5.26: 1, 9.5.27: 1)
Users (total since first seen): 23
First seen: 2026-10-27. It still happens on 9.5.27.
Platform: Android HybridApp
Error: TypeError: Cannot read property 'isContextMenuOpening' of null, thrown from the report preview onPress at src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx:174
📣 @dmkt9 You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖
@dmkt9 what's status here? If a C+ is needed, can you unassign yourself, remove then readd External to assign one, then reassign yourself? DM me in Slack if it doesn't work. Thx
@dmkt9 what's status here? If a C+ is needed, can you unassign yourself, remove then readd External to assign one, then reassign yourself? DM me in Slack if it doesn't work. Thx
This PR is still open at #105472. @mountiny Could you please assign a new C+ reviewer to take a look? Thank you!
Activity
MelvinBot commentedon Oct 29, 2026
I think the crash happens on the screen the tap opens, not in the tap handler. After a restart, the expense report's IOU action isn't in Onyx yet. So
openTransactionFromPreviewdoes three things at once:parentReportActionID(resolveChildReportID).openReportfor the expense report.navigateToExpense).The destination lists then mount and change type while data is still loading. On Android, a likely failure point is the native scroll manager. Its
scrollToIndexhas no range or layout guard (useReportScrollManager/index.native.ts:13-31).I wasn't able to verify this. The issue has no stack trace, and I can't run the Android app here. The tap path itself has no
throw, non-null assertion, or unguardedscrollToIndex.To confirm, check:
Recent PRs in this path (all in 9.5.24)
useCallback/useMemo/memofrom the preview, carousel, andTransactionPreview. The timing fits best, but I found no crash path in it.getNativeScrollRef. A later PR restored it on 10-29. Worth retesting on a build that includes that PR.Possibly related: Expense - Split preview loads infinitely and opens not here page after reset app. It also fails when opening from a preview after a reset.
Next Steps: Reply with
@MelvinBot <your feedback>to refine this analysis. A crash stack trace would help most.view run
melvin-bot commentedon Oct 29, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @marufsharifi (
External)[-]Android – App crashes when opening a transaction from a report preview after restarting the app.[/-][+][$175] Android – App crashes when opening a transaction from a report preview after restarting the app.[/+]melvin-bot commentedon Oct 29, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022115827795513184215
camesenin commentedon Oct 29, 2026
melvin-bot commentedon Oct 29, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
sonofkratos92 commentedon Oct 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, after force-closing and reopening the app in a workspace chat that contains an expense report with multiple transactions, tapping a transaction card inside the report preview crashes the app instead of opening the transaction thread report.
What is the root cause of that problem?
There are two parts to why this happens during cold-start hydration on Android:
Why
contextMenuRef.currentrepeatedly flipsvalue -> null -> valueduring hydration:In
src/GlobalModals.tsx:31-62,LazyPopoverReportActionContextMenuis mounted withref={ReportActionContextMenu.contextMenuRef}. Insidesrc/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx:64-105and348-388,PopoverReportActionContextMenusubscribes to several global Onyx collections (ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS,ONYXKEYS.BANK_ACCOUNT_LIST,ONYXKEYS.SELF_DM_REPORT_ID, etc.) and is skipped by React Compiler because it readsreportIDRef.currentandreportActionRef.currentduring render.At
src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx:500-512,useImperativeHandle(ref, () => ({ ... }))is called without a dependency array. In React's commit phase, whenever an effectfuluseImperativeHandlewithout stable dependencies re-runs on a render, React first detaches the ref in the mutation phase (safelyDetachRefsetscontextMenuRef.current = null) before attaching the newly created handle object in the layout phase (commitAttachRef). Because cold-start hydration after an app restart triggers a stream of Onyx updates across those global subscriptions,contextMenuRef.currentrepeatedly cyclesvalue -> null -> value.Why
MoneyRequestReportPreviewcrashes on press:In
src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts, all other consumers interact withcontextMenuRefthrough helper functions, whereassrc/components/ReportActionItem/MoneyRequestReportPreview/index.tsxdirectly accessescontextMenuRef.current?.isContextMenuOpeninginopenReportFromPreview(line 174) andopenTransactionFromPreview(line 333). After PR [No QA] Disallow manual memoization in compiled React code #104522 removed manualuseCallbackmemoization inMoneyRequestReportPreview/index.tsxso it is compiled by React Compiler (and lowered throughcjs-inline-requires-loader.mjson native), evaluatingcontextMenuRef.current?.isContextMenuOpeningdirectly on the imported binding during cold-start hydration crashes on Android unlesscontextMenuRef.currentis captured in a local variable first.What changes do you think we should make in order to solve the problem?
src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx, captureconst contextMenu = contextMenuRef.current;in a local variable before checkingcontextMenu?.isContextMenuOpeningin bothopenReportFromPreview(lines 173-176) andopenTransactionFromPreview(lines 332-335):and:
(Alternatively, we can export a small helper
function isContextMenuOpening(): booleanfromsrc/pages/inbox/report/ContextMenu/ReportActionContextMenu.tsthat capturesconst contextMenu = contextMenuRef.current; return !!contextMenu?.isContextMenuOpening;and callisContextMenuOpening()in both handlers soMoneyRequestReportPreviewdoes not need to touchcontextMenuRef.currentdirectly.)contextMenuRef.currentfrom detaching tonullon every background render ofPopoverReportActionContextMenuwhen the popover is closed, we can also storeisContextMenuOpeningin a ref (or keep the imperative handle methods reading from refs with a stableuseImperativeHandle(ref, () => ({ ... }), [ ... ])) insrc/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx, sinceisContextMenuOpeningis never read in JSX.What alternative solutions did you explore? (Optional)
Waiting for
contextMenuRef.currentto be non-null before allowing preview presses would block opening reports/transactions during the initial 2-second idle deferral window (IDLE_CALLBACK_TIMEOUT_MSinGlobalModals.tsx) when the context menu has not even been mounted yet. Capturingconst contextMenu = contextMenuRef.currentlocally inopenReportFromPreviewandopenTransactionFromPreviewsafely treats an unmounted or mid-commit ref as not opening while avoiding the Android crash.sijo0218 commentedon Oct 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, after force-closing and restarting the app in a workspace chat that contains an expense report with multiple transactions, tapping a transaction card in the report preview causes the app to crash instead of opening the transaction thread report.
What is the root cause of that problem?
There are three interrelated architectural and lifecycle factors causing this crash on Android:
Direct ref de-referencing bypassing encapsulation:
Across the application,
contextMenuRefinsrc/pages/inbox/report/ContextMenu/ReportActionContextMenu.tsis strictly encapsulated behind exported helper functions (showContextMenu,hideContextMenu,isActiveReportAction,clearActiveReportAction,showDeleteModal,hideDeleteModal). Each of these helpers guards access to the underlying ref.However,
src/components/ReportActionItem/MoneyRequestReportPreview/index.tsxwas the sole exception in the entire codebase, importingcontextMenuRefdirectly and evaluatingcontextMenuRef.current?.isContextMenuOpeninginline inopenReportFromPreview(line 184) andopenTransactionFromPreview(line 349).Un-memoized
useImperativeHandlecausingref.currentdetachment during Onyx hydration:In
src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx:501-513,useImperativeHandle(ref, () => ({ ... }))is declared without any dependency array.PopoverReportActionContextMenusubscribes to several global Onyx collections (ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS,ONYXKEYS.COLLECTION.REPORT_ACTIONS, etc.).During cold-start hydration following an app restart, initial data sequentially hydrates across these subscriptions, triggering multiple successive re-renders of
PopoverReportActionContextMenu. BecauseuseImperativeHandlelacks dependencies, React commits cleanup on each render—settingref.current = nullin the mutation phase before attaching the newly created imperative handle in the layout phase. This causescontextMenuRef.currentto cyclevalue -> null -> value.Android Hermes runtime crash on unmemoized member de-referencing:
Under React Native Android with Hermes, React Compiler, and inline module requires (
cjs-inline-requires-loader.mjs), evaluatingcontextMenuRef.current?.isContextMenuOpeningdirectly across the imported module binding while the ref is in transition or unattached leads to accessing properties on an uninitialized/null reference, terminating the process with a fatal native crash ("Expensify keeps stopping").What changes do you think we should make in order to solve the problem?
1. Export
isContextMenuOpeninghelper fromReportActionContextMenu.tsIn
src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts, add and export the encapsulated helper function, matchingisActiveReportActionandclearActiveReportAction:Capturing
contextMenuRef.currentin a local variable (const contextMenu = contextMenuRef.current) ensures the ref is read exactly once in a single evaluation step.2. Update
MoneyRequestReportPreview/index.tsxto consumeisContextMenuOpeningIn
src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx, replace direct access tocontextMenuRefwith the new helper:3. Stabilize
useImperativeHandleinPopoverReportActionContextMenu.tsxIn
src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx, supply[isContextMenuOpening]as the dependency array so that background Onyx hydration updates do not detach and reattach the ref on every tick:What alternative solutions did you explore? (Optional)
const contextMenu = contextMenuRef.current;locally insideMoneyRequestReportPreview: While locally capturing the ref stops the crash, leavingcontextMenuRefexposed violates the component architecture ofReportActionContextMenu, where all callers interact through exported helper functions. ProvidingisContextMenuOpening()encapsulates the ref correctly across the codebase.contextMenuRef.currentto be defined before allowing preview taps: This would introduce an artificial 2-second touch block during the idle deferral window (IDLE_CALLBACK_TIMEOUT_MSinGlobalModals.tsx) when the context menu is still lazily idle-deferred. CallingisContextMenuOpening()handles unmounted, null, or opening states cleanly with zero interaction latency.What automated tests can you add to prevent this from re-occurring?
Add unit tests in
tests/ui/MoneyRequestReportPreview.test.tsxverifying:openTransactionFromPreviewexecutes cleanly whencontextMenuRef.currentisnull(simulating cold-start pre-hydration state).openTransactionFromPreviewsafely executes whencontextMenuRef.currenttransitions during mount.isContextMenuOpening()returnsfalsewhencontextMenuRef.currentisnullwithout throwing any runtime error.Contributor details
Your Expensify account email: sijo0218@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~011091133bbb09cd1c
melvin-bot commentedon Oct 29, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
jmquero92 commentedon Oct 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, after force-closing and reopening the app in a workspace chat that contains an expense report with multiple transactions, tapping a transaction card in the report preview crashes the app instead of opening the transaction thread report.
What is the root cause of that problem?
ef={ReportActionContextMenu.contextMenuRef}. Inside src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx (lines 500-512), useImperativeHandle(ref, () => ({ ... })) is declared without a dependency array while the component subscribes to multiple global Onyx collections (TRANSACTION_VIOLATIONS, VISIBLE_REPORT_ACTIONS, BANK_ACCOUNT_LIST, etc.). During cold-start Onyx hydration after an app restart, each render detaches contextMenuRef.current = null in React's mutation phase before re-attaching the new handle in the layout phase.
What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
Blocking preview presses when contextMenuRef.current is
ull was ruled out because GlobalModals.tsx defers mounting LazyPopoverReportActionContextMenu via
equestIdleCallback (IDLE_CALLBACK_TIMEOUT_MS = 2000), so contextMenuRef.current is legitimately
ull right after startup. Capturing the ref via isContextMenuOpening() safely returns alse when unmounted or mid-hydration without blocking user taps.
Contributor details
Your Expensify account email: jmquero92@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~010b8a98bb82c2f8e6
melvin-bot commentedon Oct 29, 2026
14 remaining items
mountiny commentedon Nov 3, 2026
(Vit's agent) Sentry tracks this crash as APP-NHA. Fresh numbers:
TypeError: Cannot read property 'isContextMenuOpening' of null, thrown from the report previewonPressatsrc/components/ReportActionItem/MoneyRequestReportPreview/index.tsx:174jeffrey-graham commentedon Nov 7, 2026
melvin-bot commentedon Nov 7, 2026
melvin-bot commentedon Nov 13, 2026
Current assignee @dmkt9 is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Nov 13, 2026
📣 @dmkt9 You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖
mallenexpensify commentedon Nov 13, 2026
@dmkt9 what's status here? If a C+ is needed, can you unassign yourself, remove then readd
Externalto assign one, then reassign yourself? DM me in Slack if it doesn't work. Thxdmkt9 commentedon Nov 16, 2026
This PR is still open at #105472.
@mountiny Could you please assign a new C+ reviewer to take a look? Thank you!
mkhutornyi commentedon Nov 16, 2026
I can help
mountiny commentedon Nov 16, 2026
@mkhutornyi go ahead please