Skip to content

[Due for payment 2026-11-09] Travel-no error modal appears when clicking travel on home page #99041

Closed

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: v9.4.57-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: #98484
Email or phone of affected tester (no customers): applausetester+newpiyoa1@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 / Chrome
App Component: Other

Action Performed:

Preconditions:

  1. Sign in to https://staging.new.expensify.com with expensifail account
  2. Create two workspaces
  3. Name one workspace "Travel WS" and enable Expensify Travel on it.
  4. Name the other workspace "No Travel WS" and leave travel disabled on it, set this workspace as default WS

Steps:

  1. Navigate to Home.
  2. Click "Travel" in the quick action row above the widgets.

Expected Result:

the error modal appears, and that Expensify Travel does not open because the default WS has no travel feature enabled.

Actual Result:

the error modal doesn't appears and book travel RHP opens

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7238013_1787211378480.bandicam_2026-08-20_14-30-53-180.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Nathan Lemma
Bug ID: 7238013

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

Activity

  1. added
    Daily
    Bug
    on Aug 20, 2026
  2. applause-bot commented on Aug 20, 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/e098d3164a1c9b8c6950ad9ae744338d5fc09b0ee400835e5cfa5049c57817de

  3. MelvinBot commented on Aug 20, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The default-workspace travel guard is only wired into one branch of the Home quick-action Travel handler, so the "not enabled on your default workspace" modal is skipped on the path that opens the Book Travel RHP.

    In handleBookTravel, blockIfDefaultWorkspaceLacksTravel() is called only inside if (isTravelReady). When isTravelReady is false, execution falls through to Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS...), which opens the Book Travel RHP without ever calling the guard — so no error modal appears. This is exactly the reported symptom.

    A second, contributing flaw: travelEnabledPolicy is Object.values(allPolicies).find((p) => p?.isTravelEnabled) — the first workspace with travel enabled, not the default/active one. So with "Travel WS" enabled, the button shows and books against that workspace even though the default "No Travel WS" has travel disabled. The guard itself is correct — useDefaultWorkspaceTravelGuard checks the active policy (NVP_ACTIVE_POLICY_ID) — it just isn't invoked on the fallthrough path.

    Data flow (repro)
    1. User has "Travel WS" (travel enabled) + "No Travel WS" (default, travel disabled).
    2. travelEnabledPolicy resolves to "Travel WS" → shouldShowBookTravel = true, so the Travel button renders.
    3. isTravelReady is derived from "Travel WS"; when it's false, the handler skips the if (isTravelReady) block.
    4. Handler falls through to Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS...) — blockIfDefaultWorkspaceLacksTravel() is never called.
    5. Book Travel RHP opens; no error modal. ← the bug.

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

    Call blockIfDefaultWorkspaceLacksTravel() at the top of handleBookTravel, before the isTravelReady check, so both exit paths are gated on the default workspace having travel enabled. If it returns true, return early; otherwise continue to the existing isTravelReady / navigate logic.

    What alternative solutions did you explore? (Optional)

    Re-base travelEnabledPolicy / shouldShowBookTravel / isTravelReady on the default (active) policy (NVP_ACTIVE_POLICY_ID) instead of "any workspace with travel enabled." A traveler is provisioned only against their default workspace (per the hook's own doc comment), so this is the more principled fix — but it's a larger behavioral change and may affect when the button is shown at all. Moving the guard to the top of the handler is the minimal, targeted fix for the reported bug.

    Possibly related issues


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


    view run

  4. added
    External
    on Aug 20, 2026
  5. melvin-bot commented on Aug 20, 2026

    @melvin-bot

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

  6. melvin-bot commented on Aug 20, 2026

    @melvin-bot
  7. David-2002065 commented on Aug 20, 2026

    @David-2002065
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Clicking "Travel" in the Home quick action row does not show the "travel is not enabled on your default workspace" modal when the default workspace has travel disabled. Instead, the Book Travel page opens.

    What is the root cause of that problem?

    In handleBookTravel the default-workspace guard is wired into only one of the two exit paths:

    const handleBookTravel = useCallback(
        () =>
            interceptAnonymousUser(() => {
                if (isTravelReady) {
                    if (blockIfDefaultWorkspaceLacksTravel()) {
                        return;
                    }
                    openTravelDotLink(travelEnabledPolicy?.id);
                    return;
                }
                Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS.getRoute(travelEnabledPolicy?.id));
            }),
        [travelEnabledPolicy?.id, isTravelReady, blockIfDefaultWorkspaceLacksTravel],
    );

    isTravelReady is derived from travelEnabledPolicy — the first workspace that has travel enabled, not the default one. In the repro "Travel WS" is enabled but not yet provisioned, so hasAcceptedTravelTerms(...) is false and isTravelReady is false. Execution falls through to Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS...) on L213, which opens the Book Travel page for "Travel WS" without ever calling blockIfDefaultWorkspaceLacksTravel(). The guard itself is correct — it checks the active/default policy — it just is not invoked on the fall-through path.

    Note on a simpler-looking fix that does not work: moving blockIfDefaultWorkspaceLacksTravel() to the top of the handler and gating both paths unconditionally over-blocks a legitimate flow. The guard returns true whenever the default policy is not isTravelEnabled && hasAcceptedTravelTerms(...), so it treats "travel not enabled" and "travel enabled but terms not accepted yet" identically. A user whose default (and only) workspace has travel enabled but is still finishing setup would get the "enable travel on your default workspace or switch" modal on the quick action and be blocked from reaching the My Trips page to finish setup — even though travel is already enabled on their default. That contradicts PR #98484's own invariant ("Setting up travel on a workspace is unaffected, because only the hand-off into Expensify Travel is blocked"), which is exactly why BookTravelButton calls this guard only on the hasPolicyAcceptedTravelTerms === true branch, never on the setup branches.

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

    The bug only occurs when the quick action would hand the user off into a non-default travel-enabled workspace while the default lacks travel. So guard the hand-off for the non-default case, and leave the default workspace's own setup navigation untouched.

    In handleBookTravel:

    const handleBookTravel = useCallback(
        () =>
            interceptAnonymousUser(() => {
                // A traveler is provisioned against their default workspace, so only block a hand-off that
                // targets a non-default workspace. Booking against the default itself (including its
                // still-in-setup state) keeps falling through to the normal flow.
                const isBookingAgainstDefaultWorkspace = travelEnabledPolicy?.id === activePolicyID;
                if (!isBookingAgainstDefaultWorkspace && blockIfDefaultWorkspaceLacksTravel()) {
                    return;
                }
                if (isTravelReady) {
                    openTravelDotLink(travelEnabledPolicy?.id);
                    return;
                }
                Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS.getRoute(travelEnabledPolicy?.id));
            }),
        [travelEnabledPolicy?.id, isTravelReady, blockIfDefaultWorkspaceLacksTravel, activePolicyID],
    );

    activePolicyID is already read in the component via useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID).

    Result:

    What specific scenarios should we cover in automated tests to prevent reoccurrence of the issue?

    Unit test on QuickCreationActionsBar handleBookTravel:

    • Default workspace has travel disabled and a different workspace has travel enabled -> blockIfDefaultWorkspaceLacksTravel is invoked and Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS...) / openTravelDotLink are not called (modal path).
    • Default workspace is the travel-enabled one but terms are not accepted -> guard is not the blocking factor and Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS...) is called (setup path preserved).
    • Default workspace is travel-enabled and terms accepted -> openTravelDotLink is called with the default policy id and no modal appears.

    What alternative solutions did you explore? (Optional)

    Re-base the whole quick action on the active/default policy, mirroring TravelMenuItem (the green "+" Book travel item), which already gates visibility and readiness on activePolicy and therefore never books against a non-default workspace. This is the most principled model, but PR #98484 intentionally keeps the quick action button visible and surfaces the modal on click (Scenario 1) rather than hiding it (Scenario 6 for the FAB), so a full re-base changes when the button is shown. The scoped guard above keeps that intended visibility while fixing the missing block, so it is the smaller, lower-risk change.

  8. David-2002065 commented on Aug 20, 2026

    @David-2002065
    Contributor

    @rojiphil one thing worth flagging before this moves forward.

    The proposal above correctly identifies that the guard is only wired into the isTravelReady branch, but its suggested fix (moving blockIfDefaultWorkspaceLacksTravel() to the top of the handler and gating both paths unconditionally) over-blocks a legitimate flow.

    The guard returns true whenever the default policy is not isTravelEnabled && hasAcceptedTravelTerms(...), so it treats "travel not enabled" and "travel enabled but terms not accepted yet" identically. A user whose default (and only) workspace has travel enabled but is still finishing setup would then get the "enable travel on your default workspace or switch" modal on the quick action and be blocked from reaching the My Trips page to finish setup, even though travel is already enabled on their default. That contradicts PR #98484's own invariant that setting up travel is never blocked, which is why BookTravelButton calls this guard only on the hasPolicyAcceptedTravelTerms === true branch, never on the setup branches.

    The bug only occurs when the quick action hands off into a non-default travel-enabled workspace while the default lacks travel. So the guard should run only for that non-default hand-off, and the default workspace's own setup navigation should be left untouched:

    const handleBookTravel = useCallback(
        () =>
            interceptAnonymousUser(() => {
                // A traveler is provisioned against their default workspace, so only block a hand-off that
                // targets a non-default workspace. Booking against the default itself (including its
                // still-in-setup state) keeps falling through to the normal flow.
                const isBookingAgainstDefaultWorkspace = travelEnabledPolicy?.id === activePolicyID;
                if (!isBookingAgainstDefaultWorkspace && blockIfDefaultWorkspaceLacksTravel()) {
                    return;
                }
                if (isTravelReady) {
                    openTravelDotLink(travelEnabledPolicy?.id);
                    return;
                }
                Navigation.navigate(ROUTES.TRAVEL_MY_TRIPS.getRoute(travelEnabledPolicy?.id));
            }),
        [travelEnabledPolicy?.id, isTravelReady, blockIfDefaultWorkspaceLacksTravel, activePolicyID],
    );
    • Repro (default "No Travel WS" disabled, "Travel WS" enabled): target != default -> guard runs -> modal appears, travel does not open. Matches Scenario 1 of Show an error when the default workspace does not have travel enabled #98484.
    • Default workspace has travel enabled but terms not yet accepted: target == default -> guard skipped -> falls through to My Trips so setup can be finished. Preserves Scenario 5.

    Full write-up with test scenarios and the alternative (re-basing the quick action on the active policy like TravelMenuItem) is in my proposal above.

  9. removed
    External
    on Aug 20, 2026
  10. blimpich commented on Aug 20, 2026

    @blimpich
    Contributor

    I'm looking into this. It's a follow up from my PR.

  11. 55 remaining items

  12. melvin-bot commented on Nov 8, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. melvin-bot commented on Nov 8, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  14. mallenexpensify commented on Nov 11, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @huult due $250 via NewDot

  15. huult commented on Nov 12, 2026

    @huult
    Contributor
    Image

    I was assigned this ticket before the price was reduced to $175, so it should still be paid at $250.

    @mallenexpensify Could you check this comment? It should be $250.

  16. reopened this on Nov 12, 2026
  17. huult commented on Nov 12, 2026

    @huult
    Contributor

    I reopened this ticket because we need to update the payment summary cc @mallenexpensify

  18. mallenexpensify commented on Nov 12, 2026

    @mallenexpensify
    Contributor

    @huult payment summary updated, apologies for missing it, thx for reopening

  19. JmillsExpensify commented on Nov 15, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @huult

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineeringExternalImprovementReviewing

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions