Skip to content

[$175] [Exploratory] Workspace - App crashes when reopening workspace settings link #98300

Open

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.52-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/68133792/folder/53676493/46436410/1639586868?sort=-identifier
Email or phone of affected tester (no customers): sdsiodjnosdjiodsj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Workspace Settings

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a workspace.
  3. Go to workspace settings > Overview.
  4. Click workspace name.
  5. Copy URL.
  6. Go to Inbox and send the URL to any chat.
  7. Click on the sent link.
  8. Close workspace name RHP.
  9. Click app back button on the top left.
  10. Go to Inbox.
  11. Open the same chat from Step 6 and click on the link.

Expected Result:

App will not crash.

Actual Result:

App crashes when reopening workspace settings link.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7230735_1786424586788!staging.new.expensify.com-1786424442508.txt

Bug7230735_1786424586790.25.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7230735

Issue OwnerCurrent Issue Owner: @mananjadhav
Upwork Automation - Do Not Edit

Activity

  1. added
    Bug
    on Sep 5, 2026
  2. MelvinBot commented on Sep 5, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    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?

    1. 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.

    2. 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.

    3. 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.


    view run · no recording available

  3. added
    Daily
    and removed on Sep 5, 2026
  4. added
    External
    on Sep 5, 2026
  5. melvin-bot commented on Sep 5, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

  6. melvin-bot commented on Sep 5, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  7. mananjadhav commented on Sep 6, 2026

    @mananjadhav
    Collaborator

    Reviewing.

  8. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    @mananjadhav this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  9. 38 remaining items

  10. added
    Weekly
    and removed
    Daily
    on Nov 12, 2026
  11. changed the title [-][Exploratory] Workspace - App crashes when reopening workspace settings link[/-] [+][$175] [Exploratory] Workspace - App crashes when reopening workspace settings link[/+] on Nov 15, 2026
  12. melvin-bot commented on Nov 15, 2026

    @melvin-bot
  13. expensify-chore-bot commented on Nov 15, 2026

    @expensify-chore-bot

    Triggered auto assignment to @danieldoglas, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  14. khanjanraiyani4 commented on Nov 16, 2026

    @khanjanraiyani4

    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') 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.

  15. melvin-bot commented on Nov 16, 2026

    @melvin-bot

    📣 @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:

    1. Make sure you've read and understood the contributing guidelines.
    2. 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.
    3. 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.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  16. khanjanraiyani4 commented on Nov 16, 2026

    @khanjanraiyani4

    Contributor details
    Your Expensify account email: khanjanraiyani4@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~01764891481486f7c7?viewMode=1

  17. melvin-bot commented on Nov 16, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  18. khanjanraiyani4 commented on Nov 16, 2026

    @khanjanraiyani4
    Screen.Recording.2026-11-16.at.7.53.35.PM.mov
  19. mananjadhav commented on Nov 17, 2026

    @mananjadhav
    Collaborator

    The bug isn't reproducible on the latest main so I've closed the @MelvinBot PR.

  20. MelvinBot commented on Nov 17, 2026

    @MelvinBot
    Contributor

    ⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

    Run details

  21. mananjadhav commented on Nov 23, 2026

    @mananjadhav
    Collaborator

    @mallenexpensify The issue is not reproducible anymore but the proposal was reviewed and PR was reviewed too here.

  22. mananjadhav commented on Dec 1, 2026

    @mananjadhav
    Collaborator

    @mallenexpensify I think we have the payout due here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugExternalNot a priorityReviewingWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions