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] [Exploratory] Workspace - App crashes when reopening workspace settings link #98300
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorNot a priorityReviewingHas a PR in reviewWeeklyKSv2
The console log attached to this issue names the crash exactly:
TypeError: Cannot read properties of undefined (reading 'backTo')
at WorkspaceOverviewPage
src/pages/workspace/WorkspaceOverviewPage.tsx:97-98 reads route.params.backTo and route.params.policyID with no guard. On the second open of the link, route.params is undefined, so the component throws on its first statement — before any render guard can run.
route.params becomes undefined because WORKSPACE.PROFILE is the defaultCentralScreen of the WorkspaceSplitNavigator (WorkspaceSplitNavigator.tsx:57). When the split navigator is re-entered without its nested state, the router falls back to an initial state holding only the sidebar route, whose params are deliberately undefined. SplitRouter.ts:87-90 then injects the central screen with params: state.routes.at(0)?.params — copying that undefined straight onto WORKSPACE.PROFILE.
The first click works and the second crashes because the two clicks take different branches in linkTo: the first sees an unvisited Workspaces tab and dispatches the full nested state; the repeat visit does not.
TypeScript does not catch this. types.ts:2901-2905 types WORKSPACE.PROFILE params as {policyID: string; backTo?: Routes} without | undefined, which makes React Navigation's conditional Route type mark params as required. The type does not match runtime.
What changes do you think we should make in order to solve the problem?
Guard the crashing reads in WorkspaceOverviewPage.tsx — use optional chaining for backTo and policyID at lines 97-98 (and the same reads at lines 349 and 769), and skip the policy fetch when policyID is missing. This is exactly the pattern already applied to the sibling sidebar screen in WorkspaceInitialPage.tsx:86 by Fix workspace navigation after distance settings deep link #98423, and the wrapper this page already renders through, withPolicy.tsx:79, optional-chains the same route object.
Fix the type so this class of bug is visible. Widen the split-navigator param list entry so params is optional for WORKSPACE.PROFILE. Without this, adding ?. looks like dead code to a reviewer and will get removed again.
Preserve the policyID at the router level so the central screen is not synthesised paramless — SplitRouter.ts:87-90 should carry the sidebar's policyID rather than copying a possibly-undefined params object.
Step 1 stops the crash. Steps 2 and 3 matter because 20 of the 22 screens registered in WorkspaceSplitNavigator read route.params unguarded — only WorkspaceInitialPage and PolicyAccountingPage are defensive. A page-local fix leaves the rest as latent crash sites.
What alternative solutions did you explore? (Optional)
Alternatives considered, evidence, and verification notes
Alternative: treat this as already fixed.#98423 (merged 2026-08-31) repaired the linkTo path that dropped the split navigator's nested state — the same mechanism described above, and its PR body describes the identical /workspaces/undefined symptom. This issue was reported on 2026-08-11 against 9.4.52-0, which predates that fix. I could not rule this out as the reason: the automated web test run for this analysis failed on an infrastructure problem (the browser session never rendered), so I have no live staging confirmation either way. Even if #98423 removed this particular trigger, the unguarded read at line 97 and the incorrect type are still on main today, so the crash remains one navigation change away.
Alternative: an error boundary or a not-found page. That converts a crash into a broken screen without fixing the missing policyID, and #69850 already tracks making error pages recoverable. Not a substitute for the guard.
Alternative: a useEffect guard. Does not work here — the throw happens in the component body at line 97, before any effect runs.
Supporting evidence that params: undefined is a real runtime state: a merged test, tests/ui/WorkspaceInitialPageTest.tsx:96-101, explicitly mocks {route: {params: undefined}} for a screen in this navigator.
Git history: the unguarded const backTo = route.params.backTo; was introduced in commit 113d584b (#56204, 2025-01-16) in the then-named WorkspaceProfilePage.tsx and carried through the rename in #56920. It was never optional-chained, so no guard was removed. route.params.policyID at line 98 was added by #89414 (2026-05-08) to satisfy the no-default-id-values lint rule, which replaced a nullish-coalesced read with a raw one.
Related issues: a quick scan of open App issues found no duplicate. #69850 (error pages should be recoverable) is loosely related but not the same bug.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/98300) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
I followed the 11 steps from the issue on web, in Chrome on macOS with a wide layout. After the first link click I closed the workspace name RHP, pressed the app back button, went back
to the chat and clicked the same link again. The app didn't crash.
The original crash was Cannot read properties of undefined (reading 'backTo') in WorkspaceOverviewPage, reported on 9.4.52-0. #98423 (merged 2026-08-31) changed how linkTo
preserves the split navigator state, which may have removed the trigger.
The weak spot is still on main: WorkspaceOverviewPage.tsx reads route.params.backTo and route.params.policyID with no guard, and SplitRouter can still build a central screen
with no params if a split navigator is rebuilt without state. #106756 fixes both and adds regression tests, so it still looks worth merging.
📣 @khanjanraiyani4! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorNot a priorityReviewingHas a PR in reviewWeeklyKSv2
Activity
applause-bot commentedon Aug 11, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/ef6cd7d917f1451a1c1d30869832bd35f77eab339a2a1e2683bca48c3d7044e9
https://platform.applause.com/services/links/v1/external/ed894168cfee663a4cbb41ddd41e0e069c156ae8c2added2c5e79e1515cdffab
MelvinBot commentedon Sep 5, 2026
Proposal
What is the root cause of that problem?
The console log attached to this issue names the crash exactly:
src/pages/workspace/WorkspaceOverviewPage.tsx:97-98readsroute.params.backToandroute.params.policyIDwith no guard. On the second open of the link,route.paramsisundefined, so the component throws on its first statement — before any render guard can run.route.paramsbecomesundefinedbecauseWORKSPACE.PROFILEis thedefaultCentralScreenof theWorkspaceSplitNavigator(WorkspaceSplitNavigator.tsx:57). When the split navigator is re-entered without its nested state, the router falls back to an initial state holding only the sidebar route, whose params are deliberatelyundefined.SplitRouter.ts:87-90then injects the central screen withparams: state.routes.at(0)?.params— copying thatundefinedstraight ontoWORKSPACE.PROFILE.The first click works and the second crashes because the two clicks take different branches in
linkTo: the first sees an unvisited Workspaces tab and dispatches the full nested state; the repeat visit does not.TypeScript does not catch this.
types.ts:2901-2905typesWORKSPACE.PROFILEparams as{policyID: string; backTo?: Routes}without| undefined, which makes React Navigation's conditionalRoutetype markparamsas required. The type does not match runtime.What changes do you think we should make in order to solve the problem?
Guard the crashing reads in
WorkspaceOverviewPage.tsx— use optional chaining forbackToandpolicyIDat lines 97-98 (and the same reads at lines 349 and 769), and skip the policy fetch whenpolicyIDis missing. This is exactly the pattern already applied to the sibling sidebar screen inWorkspaceInitialPage.tsx:86by Fix workspace navigation after distance settings deep link #98423, and the wrapper this page already renders through,withPolicy.tsx:79, optional-chains the same route object.Fix the type so this class of bug is visible. Widen the split-navigator param list entry so
paramsis optional forWORKSPACE.PROFILE. Without this, adding?.looks like dead code to a reviewer and will get removed again.Preserve the
policyIDat the router level so the central screen is not synthesised paramless —SplitRouter.ts:87-90should carry the sidebar'spolicyIDrather than copying a possibly-undefinedparams object.Step 1 stops the crash. Steps 2 and 3 matter because 20 of the 22 screens registered in
WorkspaceSplitNavigatorreadroute.paramsunguarded — onlyWorkspaceInitialPageandPolicyAccountingPageare defensive. A page-local fix leaves the rest as latent crash sites.What alternative solutions did you explore? (Optional)
Alternatives considered, evidence, and verification notes
Alternative: treat this as already fixed. #98423 (merged 2026-08-31) repaired the
linkTopath that dropped the split navigator's nested state — the same mechanism described above, and its PR body describes the identical/workspaces/undefinedsymptom. This issue was reported on 2026-08-11 against 9.4.52-0, which predates that fix. I could not rule this out as the reason: the automated web test run for this analysis failed on an infrastructure problem (the browser session never rendered), so I have no live staging confirmation either way. Even if #98423 removed this particular trigger, the unguarded read at line 97 and the incorrect type are still onmaintoday, so the crash remains one navigation change away.Alternative: an error boundary or a not-found page. That converts a crash into a broken screen without fixing the missing
policyID, and #69850 already tracks making error pages recoverable. Not a substitute for the guard.Alternative: a
useEffectguard. Does not work here — the throw happens in the component body at line 97, before any effect runs.Supporting evidence that
params: undefinedis a real runtime state: a merged test,tests/ui/WorkspaceInitialPageTest.tsx:96-101, explicitly mocks{route: {params: undefined}}for a screen in this navigator.Git history: the unguarded
const backTo = route.params.backTo;was introduced in commit113d584b(#56204, 2025-01-16) in the then-namedWorkspaceProfilePage.tsxand carried through the rename in #56920. It was never optional-chained, so no guard was removed.route.params.policyIDat line 98 was added by #89414 (2026-05-08) to satisfy theno-default-id-valueslint rule, which replaced a nullish-coalesced read with a raw one.Related issues: a quick scan of open App issues found no duplicate. #69850 (error pages should be recoverable) is loosely related but not the same bug.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/98300)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · no recording available
melvin-bot commentedon Sep 5, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)melvin-bot commentedon Sep 5, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
mananjadhav commentedon Sep 6, 2026
Reviewing.
melvin-bot commentedon Sep 8, 2026
@mananjadhav this issue is now 4 weeks old, please consider:
Thanks!
38 remaining items
[-][Exploratory] Workspace - App crashes when reopening workspace settings link[/-][+][$175] [Exploratory] Workspace - App crashes when reopening workspace settings link[/+]melvin-bot commentedon Nov 15, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022122092047863900357
expensify-chore-bot commentedon Nov 15, 2026
Triggered auto assignment to @danieldoglas, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
khanjanraiyani4 commentedon Nov 16, 2026
I couldn't reproduce this on current
main.I followed the 11 steps from the issue on web, in Chrome on macOS with a wide layout. After the first link click I closed the workspace name RHP, pressed the app back button, went back
to the chat and clicked the same link again. The app didn't crash.
I tested on commit 923a53a (main, 2026-11-16).
The original crash was
Cannot read properties of undefined (reading 'backTo')inWorkspaceOverviewPage, reported on 9.4.52-0. #98423 (merged 2026-08-31) changed howlinkTopreserves the split navigator state, which may have removed the trigger.
The weak spot is still on
main:WorkspaceOverviewPage.tsxreadsroute.params.backToandroute.params.policyIDwith no guard, andSplitRoutercan still build a central screenwith no params if a split navigator is rebuilt without state. #106756 fixes both and adds regression tests, so it still looks worth merging.
melvin-bot commentedon Nov 16, 2026
📣 @khanjanraiyani4! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
khanjanraiyani4 commentedon Nov 16, 2026
Contributor details
Your Expensify account email: khanjanraiyani4@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01764891481486f7c7?viewMode=1
melvin-bot commentedon Nov 16, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
khanjanraiyani4 commentedon Nov 16, 2026
Screen.Recording.2026-11-16.at.7.53.35.PM.mov
mananjadhav commentedon Nov 17, 2026
The bug isn't reproducible on the latest main so I've closed the @MelvinBot PR.
MelvinBot commentedon Nov 17, 2026
Run details
mananjadhav commentedon Nov 23, 2026
@mallenexpensify The issue is not reproducible anymore but the proposal was reviewed and PR was reviewed too here.
mananjadhav commentedon Dec 1, 2026
@mallenexpensify I think we have the payout due here.