Skip to content

[Due for payment 2026-01-07] [$250] Reports - Link on expense preview changes to "Chat Report" after clearing cache offline #76563

Closed

Description

@vincdargento

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.2.67-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: #75704
Email or phone of affected tester (no customers): ibellicotest+2134@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app)
App Component: Search

Action Performed:

Prerequisite: Account has at least one workspace.
Prerequisite 2: Delayed submissions and approvals enabled.

  1. Open the Expensify app.
  2. Open any workspace chat.
  3. Create a manual expense.
  4. Tap on "Submit" on expense preview.
  5. Navigate to "Reports" > "Approve"
  6. Turn off internet connection.
  7. Navigate to "Account" > "Troubleshoot"
  8. Tap on "Clear cache and restart"
  9. Select "Refresh and reset"
  10. Return to "Reports" > "Approve"
  11. Turn on internet connection.
  12. Note that when expense reappears, link on preview displays "Chat Report" instead of workspace chat name.
  13. Navigate to link and return.
  14. Note that now, link is displayed correctly again.

Expected Result:

Link on expense preview on "Reports", should display the workspace chat´s name correctly after clearing cache.

Actual Result:

Link on expense preview on "Reports" changes to "Chat Report" after clearing cache while offline and returning online.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021996579616100818321
  • Upwork Job ID: 1996579616100818321
  • Last Price Increase: 2025-12-04
  • Automatic offers:
    • situchan | Reviewer | 109825578
    • apeyada | Contributor | 109825579
Issue OwnerCurrent Issue Owner: @trjExpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 2, 2025
  2. melvin-bot commented on Dec 2, 2025

    @melvin-bot

    Triggered auto assignment to @trjExpensify (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.

  3. trjExpensify commented on Dec 4, 2025

    @trjExpensify
    Contributor

    I can repro this on iOS native... the steps can be simplified to this as well btw:

    1. Go to Reports > Approve
    2. Observe the "From " hyperlink is correct
    3. Go to Troubleshoot > Clear Cache and Restart
    4. Go back to Reports > Approve
    5. Observe the "From Chat Report" hyperlink text.
  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 4, 2025
  5. changed the title [-]Reports - Link on expense preview changes to "Chat Report" after clearing cache offline[/-] [+][$250] Reports - Link on expense preview changes to "Chat Report" after clearing cache offline[/+] on Dec 4, 2025
  6. melvin-bot commented on Dec 4, 2025

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 4, 2025
  8. melvin-bot commented on Dec 4, 2025

    @melvin-bot

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

  9. ahmedelshaikh20 commented on Dec 6, 2025

    @ahmedelshaikh20
    Contributor

    Proposal

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

    After clearing cache while offline, the expense preview link in the Approve tab incorrectly displays "Chat Report" instead of the workspace chat name, until the user navigates into the report and back.

    What is the root cause of that problem?

    When cache is cleared offline, the personalDetailsList needed to compute the workspace chat's display name is temporarily unavailable. The existing logic incorrectly falls back to "Chat Report" instead of allowing the value to recompute once data is restored.

    This prevents the UI from updating after Onyx syncs back missing participant data.

    Here is the root issue:

    function getPolicyExpenseChatName({report, personalDetailsList}: {report: OnyxEntry<Report>; personalDetailsList?: Partial<PersonalDetailsList>}): string | undefined {
    const ownerAccountID = report?.ownerAccountID;
    const personalDetails = ownerAccountID ? personalDetailsList?.[ownerAccountID] : undefined;
    const login = personalDetails ? personalDetails.login : null;
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    const reportOwnerDisplayName = getDisplayNameForParticipant({accountID: ownerAccountID, shouldRemoveDomain: true, formatPhoneNumber}) || login;
    if (reportOwnerDisplayName) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('workspace.common.policyExpenseChatName', {displayName: reportOwnerDisplayName});
    }
    return report?.reportName;
    }

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

    Update getPolicyExpenseChatName() to return undefined when participant details are not yet available, so React can correctly recompute the display name once Onyx repopulates.

    function getPolicyExpenseChatName({report, personalDetailsList}: {report: OnyxEntry<Report>; personalDetailsList?: Partial<PersonalDetailsList>}): string | undefined {
        const ownerAccountID = report?.ownerAccountID;
        const personalDetails = ownerAccountID ? personalDetailsList?.[ownerAccountID] : undefined;
        const login = personalDetails ? personalDetails.login : null;
    
        const reportOwnerDisplayName =
            getDisplayNameForParticipant({accountID: ownerAccountID, shouldRemoveDomain: true, formatPhoneNumber}) || login;
    
        if (!reportOwnerDisplayName) {
            // Return undefined so the UI recalculates correctly after sync
            return undefined;
        }
    
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        return translateLocal('workspace.common.policyExpenseChatName', {displayName: reportOwnerDisplayName});
    }

    This ensures:

    • No stale fallback value is cached
    • UI re-renders once data becomes available
    • Correct workspace chat name appears without extra navigation
    IOS: mWeb
    Reports_Link_Issue.MP4

    What alternative solutions did you explore? (Optional)

    NA

  10. apeyada commented on Dec 8, 2025

    @apeyada
    Contributor

    Proposal

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

    Reports - Link on expense preview changes to "Chat Report" after clearing cache

    What is the root cause of that problem?

    This bug came from #70087

    let previousDisplayNames: Record<string, string | undefined> = {};
    let previousPersonalDetails: OnyxEntry<PersonalDetailsList> | undefined;

    When we first set personalDetails, we don't recompute report attributes because of this logic:

    if (Object.keys(previousDisplayNames).length === 0) {
    previousDisplayNames = currentDisplayNames;
    previousPersonalDetails = personalDetails;
    return false;

    Returning early here sets displayNamesChanged flag false here and then early returned:

    if (!displayNamesChanged) {
    return currentValue ?? {reports: {}, locale: null};
    }


    And When personalDetails is cleared from Onyx, there's no logic to clear previousDisplayNames and previousPersonalDetails.
    So when we secondly set personalDetails, we don't recompute report attributes because previousDisplayNames is not cleared and so it's considered same as currentDisplayNames .

    const currentKeys = Object.keys(currentDisplayNames);
    const previousKeys = Object.keys(previousDisplayNames);
    const displayNamesChanged = currentKeys.length !== previousKeys.length || currentKeys.some((key) => currentDisplayNames[key] !== previousDisplayNames[key]);

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

    • set displayNamesChanged to true when previousPersonalDetails doesn't exist and personalDetails is set in Onyx

    if (Object.keys(previousDisplayNames).length === 0) {
    previousDisplayNames = currentDisplayNames;
    previousPersonalDetails = personalDetails;
    return false;

    return Object.keys(currentDisplayNames).length > 0 instead of false


    • clear previousDisplayNames and previousPersonalDetails when personalDetails is cleared from Onyx

    if (hasKeyTriggeredCompute(ONYXKEYS.PERSONAL_DETAILS_LIST, sourceValues)) {
    displayNamesChanged = checkDisplayNamesChanged(personalDetails);
    if (!displayNamesChanged) {
    return currentValue ?? {reports: {}, locale: null};
    }
    }

    Add else condition here: (areAllConnectionsSet=true and sourceValues=undefined => this means cleared from Onyx)

            } else if (!sourceValues) {
                previousDisplayNames = {};
                previousPersonalDetails = undefined;
            }
    

    What alternative solutions did you explore? (Optional)

  11. situchan commented on Dec 8, 2025

    @situchan
    Contributor

    @TMisiukiewicz looks like this is regression from your old PR created for performance improvement.
    This proposal makes sense to me. What do you think?

  12. 22 remaining items

  13. changed the title [-][$250] Reports - Link on expense preview changes to "Chat Report" after clearing cache offline[/-] [+][Due for payment 2026-01-07] [$250] Reports - Link on expense preview changes to "Chat Report" after clearing cache offline[/+] on Dec 31, 2025
  14. melvin-bot commented on Dec 31, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Dec 31, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.89-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-01-07. 🎊

    For reference, here are some details about the assignees on this issue:

  16. melvin-bot commented on Dec 31, 2025

    @melvin-bot

    @situchan @trjExpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  17. trjExpensify commented on Jan 7, 2026

    @trjExpensify
    Contributor

    👋 checklist time here, @situchan.

  18. situchan commented on Jan 7, 2026

    @situchan
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/70087/changes#r2670379584

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Prerequisite:

    • Account has at least one workspace.
    • Delayed submissions and approvals enabled.

    Test:

    1. Open any workspace chat.
    2. Create a manual expense.
    3. Tap on "Submit" on expense preview.
    4. Navigate to "Reports" > "Approve".
    5. Observe the "From " hyperlink is correct.
    6. Go to Troubleshoot > Clear Cache and Restart.
    7. Return to "Reports" > "Approve".
    8. Verify that "From " hyperlink is correct. It should be workspace chat's name, not "Chat Report".

    Do we agree 👍 or 👎

  19. trjExpensify commented on Jan 12, 2026

    @trjExpensify
    Contributor

    Payment summary as follows:

    • $250 to @situchan for C+ (paid via upwork!)
    • $250 to @apeyada for the PR (paid via upwork!)

    Thanks, closing!

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