Skip to content

[Due for payment 2026-05-07] [$250] Not here page opens in background on selecting Pay with Business BA in offline mode #87349

Closed

Description

@jponikarchuk

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: v9.3.54-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: #87135
Email or phone of affected tester (no customers): kiatest.80+ck47261@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11/Chrome
App Component: Money Requests

Action Performed:

  1. On tab 1 - Navigate to staging.new.expensify.com
  2. Sign in to an account user A with USD currency without any policy and bank account
  3. On incognito mode - From another account user B, request money to the account user A with USD currency in USD
  4. Go back to user A account tab 1
  5. Go offline
  6. Press the Pay button > Pay with business bank account
  7. Observe Not here page displayed in background

Expected Result:

Workspace should be created in background which to be displayed in grayed out status (in 50% opacity)

Actual Result:

Not here page opens in background on selecting Pay with Business BA in offline mode

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022041808716441071221
  • Upwork Job ID: 2041808716441071221
  • Last Price Increase: 2026-04-08

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 8, 2026
  2. MelvinBot commented on Apr 8, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When a user with no workspace clicks "Pay with business bank account" while offline, createWorkspaceFromIOUPayment (BaseKYCWall.tsx:172-183) creates the workspace optimistically via Onyx, then immediately navigates to ReimbursementAccountPage (line 193).

    There is a race condition: Onyx's optimistic SET for the new policy is asynchronous, but navigation is synchronous. When ReimbursementAccountPage mounts:

    1. The offline blocking view (line 433) is skipped because the optimistic reimbursement account data makes hasLoadedData true.
    2. isLoadingPolicy (withPolicy.tsx:95) resolves to false because useOnyx for the brand-new policyID resolves with undefined before the optimistic data propagates.
    3. The empty-policy guard (line 465) fires: isEmptyObject(policy) is true → FullPageNotFoundView renders "Hmm... it's not here".

    Notably, the existing code for the has-admin-policy branch uses setNavigationActionToMicrotaskQueue (line 148) to defer navigation, but the no-policy branch (line 189-193) navigates directly — missing the same deferral.

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

    Wrap the navigation in the no-admin-policy branch (BaseKYCWall.tsx lines 188-193) with setNavigationActionToMicrotaskQueue, matching the pattern already used in the admin-policy branch at line 148. This defers navigation to the microtask queue, giving Onyx time to flush the optimistic policy data before ReimbursementAccountPage mounts and checks for it.

    // Before (navigates immediately, races with Onyx):
    if (workspaceChatReportID) {
        Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(...));
    }
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}));
    
    // After (defers navigation to microtask queue):
    setNavigationActionToMicrotaskQueue(() => {
        if (workspaceChatReportID) {
            Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(...));
        }
        Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}));
    });
    

    What alternative solutions did you explore? (Optional)

    • Awaiting Onyx updates before navigating: Would require making the selectPaymentMethod callback async and awaiting createWorkspaceFromIOUPayment's Onyx operations. More invasive change with wider blast radius.
    • Adding an offline-specific guard in ReimbursementAccountPage: Could check isOffline && isEmptyObject(policy) and show the offline blocking view instead of "Not here". This treats the symptom rather than the root cause and could mask other issues.
    Investigation details

    Data flow:

    1. SettlementButton shows "Pay with business bank account" when activeAdminPolicies.length === 0 (index.tsx:303)
    2. Button press → handlePaymentSelection → triggerKYCFlow → continueAction in KYCWall
    3. BaseKYCWall.selectPaymentMethod: BUSINESS_BANK_ACCOUNT branch, no admin policy → createWorkspaceFromIOUPayment (Policy.ts:3932)
    4. Optimistic data queued in Onyx (async), navigation fires immediately
    5. ReimbursementAccountPage renders before policy data is available → "Not here"

    Additional note: KYCWall's isDisabled prop (types.ts:46) is declared but never destructured in BaseKYCWall — the button remains clickable offline even though SettlementButton passes isDisabled={isOffline}. This is a secondary issue but not the root cause of the "Not here" page.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 8, 2026
  4. MobileMage commented on Apr 8, 2026

    @MobileMage
    Contributor

    Proposal

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

    When a user goes offline and then taps "Pay with Business Bank Account" on an IOU report, a "Not here" (NotFoundPage) appears in the background instead of the workspace being created optimistically and shown in a grayed-out/pending state.

    What is the root cause of that problem?

    In BaseKYCWall.tsx, when the user selects CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT on an IOU report with no existing admin policy, createWorkspaceFromIOUPayment is called and returns workspaceChatReportID and policyID. The code then navigates to the new workspace chat report (inside the if (workspaceChatReportID) guard), but immediately after — unconditionally and outside that guard — it also navigates to ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}). When offline, that bank account setup route has no backing data in Onyx (the API call is queued but never executes), so the router resolves the route to the "Not here" page. Because the second Navigation.navigate call fires synchronously after the first, the "Not here" page ends up on top.

    if (policyID && iouReport?.policyID) {
    savePreferredPaymentMethod(iouReport.policyID, policyID, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[iouReport?.policyID]);
    }
    completePaymentOnboarding(CONST.PAYMENT_SELECTED.BBA, introSelected, isSelfTourViewed, betas, adminsChatReportID, policyID);
    if (workspaceChatReportID) {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(workspaceChatReportID, reportPreviewReportActionID));
    }
    // Navigate to the bank account set up flow for this specific policy
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}));
    return;

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

    We should skip the navigation to BANK_ACCOUNT_WITH_STEP_TO_OPEN when the user is offline, since the workspace and bank account data have not been persisted to the server yet and any route that depends on real server data will resolve to "Not here". The workspace chat navigation alone is sufficient when offline — the user will see the optimistically created workspace in a pending state, which matches the expected result. The bank account setup navigation can fire once the user is back online.

    To do this we need to bring isOffline from useNetwork into BaseKYCWall and guard the bank account setup navigation:

    +import useNetwork from '@hooks/useNetwork';
     ...
    
     function KYCWall({ ... }) {
    +    const {isOffline} = useNetwork();
         ...
         // inside selectPaymentMethod, after createWorkspaceFromIOUPayment:
         if (workspaceChatReportID) {
             Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(workspaceChatReportID, reportPreviewReportActionID));
         }
    
    -    // Navigate to the bank account set up flow for this specific policy
    -    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}));
    +    // Navigate to the bank account set up flow only when online,
    +    // since the route requires server-persisted data.
    +    if (!isOffline) {
    +        Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}));
    +    }

    // Navigate to the bank account set up flow for this specific policy
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}));
    return;

    What alternative solutions did you explore? (Optional)

    N/A

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 8, 2026
  6. melvin-bot commented on Apr 8, 2026

    @melvin-bot

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

  7. changed the title [-]Not here page opens in background on selecting Pay with Business BA in offline mode[/-] [+][$250] Not here page opens in background on selecting Pay with Business BA in offline mode[/+] on Apr 8, 2026
  8. melvin-bot commented on Apr 8, 2026

    @melvin-bot
  9. KJ21-ENG commented on Apr 8, 2026

    @KJ21-ENG
    Contributor

    Proposal

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

    When a user with no workspace selects Pay with business bank account while offline, the flow should stay on optimistic/pending workspace state, but a “Not here” page appears in the background.

    What is the root cause of that problem?

    In BaseKYCWall, the existing-admin-policy path defers navigation with setNavigationActionToMicrotaskQueue, but the no-admin-policy path (where createWorkspaceFromIOUPayment is called) performs immediate navigation and then immediately pushes the bank-account route.

    setNavigationActionToMicrotaskQueue(() => {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(inviteResult.policyExpenseChatReportID));
    if (adminPolicy?.achAccount) {
    return;
    }
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID: adminPolicy.id}));
    });

    const {policyID, workspaceChatReportID, reportPreviewReportActionID, adminsChatReportID} =
    createWorkspaceFromIOUPayment(iouReport, reportPreviewAction, currentUserEmail, employeeEmail) ?? {};
    if (policyID && iouReport?.policyID) {
    savePreferredPaymentMethod(iouReport.policyID, policyID, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[iouReport?.policyID]);
    }
    completePaymentOnboarding(CONST.PAYMENT_SELECTED.BBA, introSelected, adminsChatReportID, policyID);
    if (workspaceChatReportID) {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(workspaceChatReportID, reportPreviewReportActionID));
    }
    // Navigate to the bank account set up flow for this specific policy
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID}));
    return;

    That immediate route transition can mount ReimbursementAccountPage before policy data is available for the new policy, and this screen can resolve to its not-found guard once loading settles with an empty/non-admin policy.

    const isLoadingPolicy = !hasLoadedApp || isLoadingOnyxValue(policyResults, policyDraftResults);
    if (policyID && policyID.length > 0) {
    updateLastAccessedWorkspace(policyID);
    }

    if (isLoadingPolicy) {
    return <FullScreenLoadingIndicator />;
    }
    // Show loading indicator when page is first time being opened and props.reimbursementAccount yet to be loaded from the server
    // or when data is being loaded. Don't show the loading indicator if we're offline and restarted the bank account setup process
    // On Android, when we open the app from the background, Onfido activity gets destroyed, so we need to reopen it.
    if ((isLoading || isLoadingWorkspaceReimbursement) && shouldShowOfflineLoader && (shouldReopenOnfido || !requestorStepRef?.current)) {
    return <ReimbursementAccountLoadingIndicator onBackButtonPress={goBack} />;
    }
    if (!!policyIDParam && ((!isLoading && (isEmptyObject(policy) || !isPolicyAdmin(policy))) || isPendingDeletePolicy(policy))) {
    return (
    <ScreenWrapper testID="ReimbursementAccountPage">
    <FullPageNotFoundView
    shouldShow
    onBackButtonPress={goBackFromInvalidPolicy}
    onLinkPress={goBackFromInvalidPolicy}
    subtitleKey={isEmptyObject(policy) || isPendingDeletePolicy(policy) ? undefined : 'workspace.common.notAuthorized'}

    I could download but could not decode the attached video in this unattended environment, so I am not claiming frame-level visual verification.

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

    1. In the no-admin-policy branch, wrap post-creation navigation in setNavigationActionToMicrotaskQueue (same pattern used in the admin-policy branch) so optimistic policy/report updates settle before route evaluation.
    2. Keep the workspace chat navigation first, then bank-account setup navigation, but execute both inside that deferred callback.
    3. As a safety guard, skip or defer bank-account setup navigation while offline when required data is not ready yet, to avoid surfacing NotFound during optimistic creation.

    What alternative solutions did you explore? (Optional)

    A narrower alternative is to only gate bank-account navigation by offline status. That helps this exact scenario, but it does not address the broader timing inconsistency between the two BBA code paths. Aligning both paths to deferred navigation is more robust.

  10. snakefood3232 commented on Apr 8, 2026

    @snakefood3232

    I'll work on this offline mode issue where the "Not here" page incorrectly appears instead of a grayed-out workspace.

    Approach:

    1. Trace the navigation flow when "Pay with business bank account" is clicked offline
    2. Check the conditional logic that determines whether to show workspace creation vs. "Not here" page
    3. Ensure offline state properly triggers the workspace creation UI with 50% opacity

    Timeline: I can have a PR ready within 2-3 days after investigating the specific code paths involved in this payment flow.

  11. snakefood3232 commented on Apr 8, 2026

    @snakefood3232

    I'll work on this issue. The problem occurs when offline mode triggers the "Not here" page instead of creating a workspace when selecting "Pay with business bank account."

    My approach:

    1. Check the offline handling logic in the payment flow to ensure workspace creation is attempted before showing the offline error page
    2. Verify the conditional rendering logic for the workspace creation modal vs. offline state
    3. Ensure proper state management when network connectivity is lost during the payment process

    I can have a fix ready for review within 2-3 days.

  12. snakefood3232 commented on Apr 8, 2026

    @snakefood3232

    I'll work on this issue where the "Not here" page appears in offline mode instead of the expected workspace creation.

    Approach:

    1. Trace the offline flow when "Pay with business bank account" is selected to identify why workspace creation is bypassed
    2. Check the conditional logic that determines whether to show workspace creation vs. the "Not here" page
    3. Ensure proper offline handling maintains the expected UI state

    Timeframe: I can have a PR ready within 2-3 days after investigation.

    I'm familiar with the codebase and can implement a fix that maintains both online and offline functionality.

  13. 37 remaining items

  14. melvin-bot commented on May 6, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on May 7, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2041808716441071221/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. mallenexpensify commented on May 8, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @nabi-ebrahimi paid $250 via Upwork
    Contributor+: @brunovjk due $250 via NewDot

    @nabi-ebrahimi can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022041808716441071221

    @nabi-ebrahimi can you plz enter your Upwork deets again, per the format below, hoping we fixed a bug that'll store yours.

    Contributor details
    Your Expensify account email: email@email.com
    Upwork Profile Link: upwork.com/freelancers/~xxxxx

  17. nabi-ebrahimi commented on May 8, 2026

    @nabi-ebrahimi

    Contributor details
    Your Expensify account email: nabi.zarin.work@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0153e611bb8e745154

  18. melvin-bot commented on May 8, 2026

    @melvin-bot

    ⚠️ Unable to store contributor details

    Details
    Auth SetContributorDetails returned an error
    401 Contributor details already exist
    
  19. nabi-ebrahimi commented on May 8, 2026

    @nabi-ebrahimi

    @mallenexpensify, the offer accepted. thanks.

  20. brunovjk commented on May 8, 2026

    @brunovjk
    Contributor

    Requested in ND. Thank you.

  21. laurenreidexpensify commented on May 8, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @brunovjk

  22. melvin-bot commented on May 11, 2026

    @melvin-bot

    @mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  23. nabi-ebrahimi commented on May 12, 2026

    @nabi-ebrahimi

    @mallenexpensify, could you please take a look at this when you get a chance. thanks.

  24. mallenexpensify commented on May 12, 2026

    @mallenexpensify
    Contributor

    @nabi-ebrahimi paid, summary updated above. Thx for the ping.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions