Skip to content

Expense - Workspace selector opens after selecting default workspace and choosing category #94551

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.4.19-1
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #93402
Email or phone of affected tester (no customers): jnsodijosdnjosjio@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Create two workspaces.
  • Set personal policy as default policy on OD.
  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create an expense.
  4. Open the expense.
  5. Click Category.
  6. Select any workspace.
  7. Choose any category.

Expected Result:

RHP will close.

Actual Result:

Workspace selector opens after selecting default workspace and choosing category.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7190650_1782372384532.16.mp4

View all open jobs on GitHub

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

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 25, 2026
  2. applause-bot commented on Jun 25, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/828b3d9280639ab6edaa820cb335a0fdbd9f0890c3104caad1eeb1a46e759b5a

  3. melvin-bot commented on Jun 25, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #93402

  4. melvin-bot commented on Jun 25, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Jun 25, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. MelvinBot commented on Jun 25, 2026

    @MelvinBot
    Contributor

    Proposal

    Confidence: High — root cause is deterministic from the code and matches the diff of the suspected PR (#93402).

    What is the root cause of that problem?

    PR #93402 migrated the Category step to the new "dynamic route" system, but in the workspace‑selector branch of MoneyRequestView's Category onPress, the explicit backTo route (the original expense RHP) was dropped.

    In src/components/ReportActionItem/MoneyRequestView.tsx:1262-1274, the !policy && shouldSelectPolicy branch calls createDynamicRoute(MONEY_REQUEST_STEP_CATEGORY.getRoute(...)) without passing a basePath. When no basePath is supplied, createDynamicRoute falls back to Navigation.getActiveRoute(), so the category route gets anchored to the workspace‑selector context instead of the expense RHP. After a category is chosen, the page computes its back target with useDynamicBackPath (which just strips the category suffix), so goBack lands the user back on the workspace selector → the loop.

    The analogous, non‑migrated distance‑rate branch right above it still does this correctly — it threads Navigation.getActiveRoute() as the backTo (MoneyRequestView.tsx:948-961) — which is exactly the argument the category branch lost.

    Evidence / data flow
    1. Self‑DM expense RHP open → user taps Category.
    2. With multiple workspaces + personal default policy, shouldSelectPolicy is true → the !policy && shouldSelectPolicy branch runs and navigates to SET_DEFAULT_WORKSPACE with navigateTo = a dynamic category route whose base was captured from the current active route (no explicit RHP backTo).
    3. User selects a workspace → SetDefaultWorkspacePage does Navigation.navigate(navigateTo) → opens the category page anchored to the wrong base.
    4. User picks a category → updateCategory/navigateBack → Navigation.goBack(backPath) where backPath comes from useDynamicBackPath (suffix stripped off the wrongly‑anchored base) → returns to the workspace selector instead of dismissing the RHP.

    Old code (removed in the PR) passed Navigation.getActiveRoute() as an explicit backTo into the category route, so goBack dismissed the RHP correctly.

    What changes do you think we should make in order to solve the problem?

    In the !policy && shouldSelectPolicy branch at MoneyRequestView.tsx:1262-1274, pass the original expense RHP route as the explicit basePath (second argument) to createDynamicRoute, mirroring the distance‑rate branch and the other category branches in the same file. getReportRHPActiveRoute() is already available in this component (from useActiveRoute() at line 202 and used elsewhere, e.g. lines 898/910/970). This makes useDynamicBackPath strip the category suffix and return to the expense RHP (dismissing it) instead of the workspace selector.

    The same latent pattern should be double‑checked in the other migrated selector branches (tax rate / tax amount / attendee) that also rely on createDynamicRoute's implicit basePath when reached through an intermediate selector screen.

    What alternative solutions did you explore? (Optional)

    Reverting #93402 would also fix it, but a targeted fix (restoring the explicit basePath) is preferable for a deploy blocker since the rest of the migration is working.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/94551) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  7. m-natarajan commented on Jun 25, 2026

    @m-natarajan

    Not repro, Chrome / v9.4.19-3 (Pending validation in iOS and Android)

    REC-20260625173905.mp4
  8. m-natarajan commented on Jun 25, 2026

    @m-natarajan

    Xiaomi Redmi Note 10 / Android 12
    app 9.4.19-3
    Not repro

    Screenrecorder-2026-06-25-18-41-28-878.mp4
  9. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions