Skip to content

[$250] [Awaiting Payment] Expense - Not here page is displayed when a member deletes an expense #80893

Closed

Description

@nlemma

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.3.11-1
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://github.com/Expensify/Expensify/issues/514747
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10 - Chrome
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. As user A, create a workspace and add user B as a member.
  3. As user B, go to the WS chat and create an expense.
  4. As user A, go to the WS chat of user B and open the expense.
  5. As user B, delete the expense.
  6. Navigate back to the tab where you are logged in as user A

Expected Result:

user A is navigated back to the main chat.

Actual Result:

Not here page is displayed when the member deletes the expense

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7057900_1769361235725.bandicam_2026-01-25_20-02-41-632.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @bfitzexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022029940815548658628
  • Upwork Job ID: 2029940815548658628
  • Last Price Increase: 2026-03-06

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 29, 2026
  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 29, 2026
  3. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 29, 2026
  4. melvin-bot commented on Jan 29, 2026

    @melvin-bot

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

  5. melvin-bot commented on Jan 29, 2026

    @melvin-bot

    Triggered auto assignment to @bfitzexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  6. daledah commented on Jan 29, 2026

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-01-29 15:19:56 UTC.

    Proposal

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

    When User A views an expense created by User B in a workspace chat, and User B deletes the expense while User A has it open, User A sees a "Not here" page instead of being redirected back to the workspace chat.

    What is the root cause of that problem?

    The issue is in ReportScreen.tsx. The shouldShowNotFoundPage calculation doesn't account for the reportWasDeleted state:

    const shouldShowNotFoundPage = useMemo((): boolean => {
    const isInvalidReportPath = !!currentReportIDFormRoute && !isValidReportIDFromPath(currentReportIDFormRoute);
    const isLoading = isLoadingApp !== false || isLoadingReportData || !!reportMetadata?.isLoadingInitialReportActions;
    const reportExists = !!reportID || isOptimisticDelete || userLeavingStatus;
    if (shouldShowNotFoundLinkedAction) {
    return true;
    }
    if (isInvalidReportPath) {
    return true;
    }
    if (isLoading) {
    return false;
    }
    if (firstRender) {
    return false;
    }
    return !reportExists;
    }, [
    shouldShowNotFoundLinkedAction,
    isLoadingApp,
    isLoadingReportData,
    reportMetadata?.isLoadingInitialReportActions,
    reportID,
    isOptimisticDelete,
    userLeavingStatus,
    currentReportIDFormRoute,
    firstRender,
    ]);

    When an expense report is deleted by another user:

    1. The useReportWasDeleted hook detects the deletion and sets reportWasDeleted to true
    2. However, shouldShowNotFoundPage becomes true because reportExists is false (report was removed from Onyx)
    3. The "Not here" page is shown immediately
    4. There's a useEffect (lines 838-860) that should redirect when reportWasDeleted is true AND the screen is focused, but it cannot help because the "Not here" page is already rendered synchronously before the navigation effect can execute

    useEffect(() => {
    if (!reportWasDeleted) {
    return;
    }
    // Only redirect if focused
    if (!isFocused) {
    return;
    }
    // Try to navigate to parent report if available
    if (deletedReportParentID && !isMoneyRequestReportPendingDeletion(deletedReportParentID)) {
    Navigation.isNavigationReady().then(() => {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(deletedReportParentID));
    });
    return;
    }
    // Fallback to Concierge
    Navigation.isNavigationReady().then(() => {
    navigateToConciergeChat(conciergeReportID);
    });
    }, [reportWasDeleted, isFocused, deletedReportParentID, conciergeReportID]);

    The navigation effect exists and works correctly - it tries to navigate to the parent report (workspace chat) when a report is deleted. But the UI renders the "Not here" page before this effect can redirect the user.

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

    Modify the shouldShowNotFoundPage calculation to not show the "Not here" page when reportWasDeleted is true. This allows the navigation useEffect to properly redirect the user to the parent report (workspace chat) instead of showing a dead-end "Not here" page.

    --- a/src/pages/inbox/ReportScreen.tsx
    +++ b/src/pages/inbox/ReportScreen.tsx
    @@ -526,6 +526,11 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
         // eslint-disable-next-line rulesdir/no-negated-variables
         const shouldShowNotFoundPage = useMemo((): boolean => {
    +        // If the report was deleted, don't show the "Not here" page - let the navigation
    +        // effect handle redirection to the parent report
    +        if (reportWasDeleted) {
    +            return false;
    +        }
    +
             const isInvalidReportPath = !!currentReportIDFormRoute && !isValidReportIDFromPath(currentReportIDFormRoute);
             const isLoading = isLoadingApp !== false || isLoadingReportData || !!reportMetadata?.isLoadingInitialReportActions;
             const reportExists = !!reportID || isOptimisticDelete || userLeavingStatus;
    @@ -548,6 +553,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
     
             return !reportExists;
         }, [
    +        reportWasDeleted,
             shouldShowNotFoundLinkedAction,
             isLoadingApp,
             isLoadingReportData,

    This ensures that when a report is deleted:

    1. reportWasDeleted becomes true
    2. shouldShowNotFoundPage returns false (because of the new early return)
    3. The navigation useEffect detects reportWasDeleted is true and redirects to the parent report (workspace chat)
  7. annaweber830 commented on Jan 29, 2026

    @annaweber830
    Contributor

    Proposal

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

    When User A is viewing an expense report in a workspace chat and User B deletes that expense, User A is shown the "Not here" page instead of being redirected back to the workspace chat.

    What is the root cause of that problem?

    ReportScreen decides to render the Not Found view as soon as the report disappears from Onyx, but the shouldShowNotFoundPage calculation does not account for the reportWasDeleted state that is set by useReportWasDeleted.

    const shouldShowNotFoundPage = useMemo((): boolean => {
    const isLoading = isLoadingApp !== false || !!isLoadingReportData || !!reportMetadata?.isLoadingInitialReportActions;
    const reportExists = !!reportID || !!isOptimisticDelete || !!userLeavingStatus;
    const isInvalidReportPath = !!currentReportIDFormRoute && !isValidReportIDFromPath(currentReportIDFormRoute);
    if (shouldShowNotFoundLinkedAction) {
    return true;
    }
    if (isLoading) {
    return false;
    }
    if (firstRender) {
    return false;
    }
    if (!reportExists) {
    return true;
    }
    return isInvalidReportPath;
    }, [
    shouldShowNotFoundLinkedAction,
    isLoadingApp,
    isLoadingReportData,
    reportMetadata?.isLoadingInitialReportActions,
    reportID,
    isOptimisticDelete,
    userLeavingStatus,
    currentReportIDFormRoute,
    firstRender,
    ]);

    const shouldShowNotFoundPage = useMemo((): boolean => {
        const isLoading = isLoadingApp !== false || !!isLoadingReportData || !!reportMetadata?.isLoadingInitialReportActions;
        const reportExists = !!reportID || !!isOptimisticDelete || !!userLeavingStatus;
        const isInvalidReportPath = !!currentReportIDFormRoute && !isValidReportIDFromPath(currentReportIDFormRoute);
    
        if (shouldShowNotFoundLinkedAction) {
            return true;
        }
    
        if (isLoading) {
            return false;
        }
    
        if (firstRender) {
            return false;
        }
    
        if (!reportExists) {
            return true;
        }
    
        return isInvalidReportPath;
    }, [
        shouldShowNotFoundLinkedAction,
        isLoadingApp,
        isLoadingReportData,
        reportMetadata?.isLoadingInitialReportActions,
        reportID,
        isOptimisticDelete,
        userLeavingStatus,
        currentReportIDFormRoute,
        firstRender,
    ]);
    

    When User B deletes the expense, reportID becomes undefined so reportExists is false and shouldShowNotFoundPage returns true, which renders the Not Found view immediately. The redirect logic that runs when reportWasDeleted is true is a later effect, so the UI briefly (and sometimes persistently) shows the "Not here" page before the navigation can take the user back to the parent report.

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

    Update shouldShowNotFoundPage to return false when reportWasDeleted is true, so we avoid rendering the Not Found view while the deletion redirect effect is about to navigate the user back to the parent report.

    const shouldShowNotFoundPage = useMemo((): boolean => {
    const isLoading = isLoadingApp !== false || !!isLoadingReportData || !!reportMetadata?.isLoadingInitialReportActions;
    const reportExists = !!reportID || !!isOptimisticDelete || !!userLeavingStatus;
    const isInvalidReportPath = !!currentReportIDFormRoute && !isValidReportIDFromPath(currentReportIDFormRoute);
    if (shouldShowNotFoundLinkedAction) {
    return true;
    }
    if (isLoading) {
    return false;
    }
    if (firstRender) {
    return false;
    }
    if (!reportExists) {
    return true;
    }
    return isInvalidReportPath;
    }, [
    shouldShowNotFoundLinkedAction,
    isLoadingApp,
    isLoadingReportData,
    reportMetadata?.isLoadingInitialReportActions,
    reportID,
    isOptimisticDelete,
    userLeavingStatus,
    currentReportIDFormRoute,
    firstRender,
    ]);

    Current code:

    const shouldShowNotFoundPage = useMemo((): boolean => {
        const isLoading = isLoadingApp !== false || !!isLoadingReportData || !!reportMetadata?.isLoadingInitialReportActions;
        const reportExists = !!reportID || !!isOptimisticDelete || !!userLeavingStatus;
        const isInvalidReportPath = !!currentReportIDFormRoute && !isValidReportIDFromPath(currentReportIDFormRoute);
    
        if (shouldShowNotFoundLinkedAction) {
            return true;
        }
    
        if (isLoading) {
            return false;
        }
    
        if (firstRender) {
            return false;
        }
    
        if (!reportExists) {
            return true;
        }
    
        return isInvalidReportPath;
    }, [
        shouldShowNotFoundLinkedAction,
        isLoadingApp,
        isLoadingReportData,
        reportMetadata?.isLoadingInitialReportActions,
        reportID,
        isOptimisticDelete,
        userLeavingStatus,
        currentReportIDFormRoute,
        firstRender,
    ]);
    

    Updated code:

    const shouldShowNotFoundPage = useMemo((): boolean => {
        const isLoading = isLoadingApp !== false || !!isLoadingReportData || !!reportMetadata?.isLoadingInitialReportActions;
        const reportExists = !!reportID || !!isOptimisticDelete || !!userLeavingStatus;
        const isInvalidReportPath = !!currentReportIDFormRoute && !isValidReportIDFromPath(currentReportIDFormRoute);
    
        if (shouldShowNotFoundLinkedAction) {
            return true;
        }
    
        if (reportWasDeleted) {
            return false;
        }
    
        if (isLoading) {
            return false;
        }
    
        if (firstRender) {
            return false;
        }
    
        if (!reportExists) {
            return true;
        }
    
        return isInvalidReportPath;
    }, [
        shouldShowNotFoundLinkedAction,
        reportWasDeleted,
        isLoadingApp,
        isLoadingReportData,
        reportMetadata?.isLoadingInitialReportActions,
        reportID,
        isOptimisticDelete,
        userLeavingStatus,
        currentReportIDFormRoute,
        firstRender,
    ]);
    

    This keeps the Not Found view for true invalid routes and linked-action cases, but avoids showing it when the report was deleted and the redirect effect is expected to run.

    What alternative solutions did you explore? (Optional)

    I considered forcing navigation earlier (e.g., converting the deletion redirect to a layout effect), but suppressing the Not Found view when reportWasDeleted is true is the smallest change that aligns with the existing deletion flow.

  8. yatin-italy commented on Jan 30, 2026

    @yatin-italy

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  9. github-actions commented on Jan 30, 2026

    @github-actions
    Contributor

    ⚠️ @yatin-italy Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  10. paulnjs commented on Jan 30, 2026

    @paulnjs
    Contributor

    Proposal

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

    • When a member deletes an expense, they are shown the "Not Here" page instead of being navigated back to a previous screen.

    What is the root cause of that problem?

    • In this screen, we do not handle the case where the user no longer has access to the report. As a result, the UI defaults to showing the "Not Here" page. In contrast, we already handle this case correctly in the ReportScreen by navigating the user away when the report becomes inaccessible.

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

    • We should add a useEffect hook to detect when the expense report is removed, similar to the logic used in ReportScreen. This will allow us to navigate the user back instead of displaying an error page. Below is a simplified version of the implementation:
    
    function isEmpty(report: OnyxEntry<OnyxTypes.Report>): boolean {
        if (isEmptyObject(report)) {
            return true;
        }
        return !Object.values(report).some((value) => value !== undefined && value !== '');
    }
    
    const [firstRender, setFirstRender] = useState(true);
    
    useEffect(() => {
        if (firstRender) {
            setFirstRender(false);
            return;
        }
    
        const isRemovalExpectedForReportType = isEmpty(report) && isMoneyRequestReport(prevReport);
    
        if (isRemovalExpectedForReportType) {
            if (!isFocused) {
                return;
            }
            Navigation.dismissModal();
        }
    }, [report]);
    
    • This effect ensures the user is redirected if the report is deleted or becomes unavailable, aligning behavior with other report screens.

    What alternative solutions did you explore? (Optional)

    • None at this time, as reusing the pattern established in ReportScreen is the most consistent and reliable approach.
  11. truph01 commented on Feb 2, 2026

    @truph01
    Contributor

    @paulnjs 's proposal looks good and works well.

    🎀 👀 🎀 C+ reviewed

  12. 25 remaining items

  13. added
    ExternalAdded to denote the issue can be worked on by a contributor
    and removed
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 6, 2026
  14. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 6, 2026
  15. melvin-bot commented on Mar 6, 2026

    @melvin-bot

    Current assignee @truph01 is eligible for the External assigner, not assigning anyone new.

  16. changed the title [-][Awaiting Payment] Expense - Not here page is displayed when a member deletes an expense[/-] [+][$250] [Awaiting Payment] Expense - Not here page is displayed when a member deletes an expense[/+] on Mar 6, 2026
  17. melvin-bot commented on Mar 6, 2026

    @melvin-bot
  18. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 6, 2026
  19. pecanoro commented on Mar 6, 2026

    @pecanoro
    Contributor

    I re-added the label so the issue could be created in Upwork

  20. MelvinBot commented on Mar 6, 2026

    @MelvinBot
    Contributor

    🔍 Issue Analysis

    Summary: When User A is viewing an expense report (opened via SearchMoneyRequestReportPage) and User B deletes that expense, User A sees a "Not here" page instead of being navigated back.

    Status: This issue already has an approved proposal from paulnjs (comment) and a merged fix in PR #81620.

    Root Cause: The bug is in SearchMoneyRequestReportPage.tsx, not ReportScreen.tsx. The page has a shouldShowAccessErrorPage useMemo that evaluates to true during pending deletion states (isReportPendingDeletion, wereAllTransactionsDeleted, etc.), rendering FullPageNotFoundView immediately. While there is an existing dismissModal useEffect (lines 83-100) that handles full report removal from Onyx, it only fires when the report object becomes completely null — which happens after the pending deletion state triggers the "Not here" page. The timing gap between pending deletion (where the NotFound view renders) and full Onyx removal (where dismissModal fires) is what causes the bug.

    Fix (already merged): The merged PR added a useEffect that detects when the report enters a deletion/removal state and calls Navigation.dismissModal() before the shouldShowAccessErrorPage can render the NotFound view, aligning with the pattern used in ReportScreen.tsx.

    Detailed Investigation

    Root Cause Analysis

    The SearchMoneyRequestReportPage.tsx page has two competing mechanisms:

    1. shouldShowAccessErrorPage (lines 327-358): A useMemo that returns true when isReportPendingDeletion, wereAllTransactionsDeleted, wasParentActionDeleted, or isThreadReportDeletedForReview is true. This triggers FullPageNotFoundView at line 404.

    2. dismissModal useEffect (lines 83-100): Detects when report becomes null (full Onyx removal) while prevReport was a money request report, then calls Navigation.dismissModal().

    The problem: When User B deletes an expense, the deletion goes through stages:

    • First, the report enters a pending deletion state (transactions get pendingAction=DELETE)
    • shouldShowAccessErrorPage fires immediately at this stage, showing the "Not here" page
    • Only later is the report fully removed from Onyx, which would trigger the dismissModal useEffect
    • The user sees the NotFound page in the window between these two events

    In contrast, ReportScreen.tsx handles this correctly by using the useReportWasDeleted hook plus an inline isRemovalExpectedForReportType check that both navigate away before the NotFound view can render.

    Evidence Chain

    • shouldShowAccessErrorPage at App/src/pages/Search/SearchMoneyRequestReportPage.tsx:327-358 → evaluates true during pending deletion
    • FullPageNotFoundView at App/src/pages/Search/SearchMoneyRequestReportPage.tsx:404-410 → renders "Not here" page
    • Existing dismissModal at App/src/pages/Search/SearchMoneyRequestReportPage.tsx:83-100 → only fires on full Onyx removal (too late)
    • ReportScreen.tsx comparison at App/src/pages/inbox/ReportScreen.tsx:701-768,798-820 → handles both pending deletion and full removal

    Relevant Code

    • App/src/pages/Search/SearchMoneyRequestReportPage.tsx:83-100 - Existing dismissModal useEffect (insufficient for pending deletion)
    • App/src/pages/Search/SearchMoneyRequestReportPage.tsx:327-358 - shouldShowAccessErrorPage condition that triggers the bug
    • App/src/pages/inbox/ReportScreen.tsx:701-768 - ReportScreen's more comprehensive deletion handling (for comparison)

    Note: This issue is already resolved — the approved proposal from paulnjs was implemented in PR #81620 (merged 2026-02-17). The issue is currently in Awaiting Payment status.

  21. bfitzexpensify commented on Mar 6, 2026

    @bfitzexpensify
    Contributor

    Payment summary:

    @truph01 owed $250 via NewDot manual request
    @paulnjs owed $250 via Upwork - offer sent

  22. bfitzexpensify commented on Mar 7, 2026

    @bfitzexpensify
    Contributor

    Payments complete

  23. JmillsExpensify commented on Mar 18, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @truph01

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