Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.56k stars 2.9k forks source link

Workspace - "Closed this report" briefly displayed when opening deleted WS chat first time #52698

Open IuliiaHerets opened 2 hours ago

IuliiaHerets commented 2 hours ago

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.0.63-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y Issue reported by: Applause Internal Team

Action Performed:

  1. Open the Expensify app.
  2. Tap on "Settings" on the bottom of the screen.
  3. Tap on "Workspaces"
  4. Tap on the three dots icon on any workspace and delete it.
  5. Return to LHN.
  6. Open the just deleted workspace chat.
  7. Verify that no new messages can be sent on chat and that no "Closed this report" message is displayed.
  8. Open the #Admins room of the deleted workspace.
  9. Return to LHN and verify that the chat didn´t disappear.

Expected Result:

When opening a deleted workspace chat, no "Closed this report" message should be displayed and the #Admins room should remain on LHN when opened.

Actual Result:

When a deleted workspace chat is opened for the first time, a "Closed this report" message is displayed for some seconds, and when #Admins room of that workspace is opened, it disappears from LHN and reappears when app is reopened.

Workaround:

Unknown

Platforms:

Screenshots/Videos

Bug6667894_1731932425301!e4a55557-48fb-4276-ad9f-a62b22c15f2d

https://github.com/user-attachments/assets/72d5baa9-26df-486c-8319-f640e2c92f2d

View all open jobs on GitHub

melvin-bot[bot] commented 2 hours ago

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

FitseTLT commented 34 minutes ago

Proposal

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

Workspace - "Closed this report" briefly displayed when opening deleted WS chat first time

What is the root cause of that problem?

We already hide closed this report report actions here https://github.com/Expensify/App/blob/63c8dd2bb44deb2d62e223530fa0d734f1cfba5c/src/pages/home/report/ReportActionsList.tsx#L193 https://github.com/Expensify/App/blob/63c8dd2bb44deb2d62e223530fa0d734f1cfba5c/src/libs/ReportActionsUtils.ts#L653 But we haven't applied the condition to check if the report action is visible for mostRecentReportAction in report screen here https://github.com/Expensify/App/blob/63c8dd2bb44deb2d62e223530fa0d734f1cfba5c/src/pages/home/ReportScreen.tsx#L704-L709 hence it appears briefly via ReportScreen for shouldShowSkeleton case and disappears when ReportActionList is displayed as it filters it out.

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

We should apply the same logic we use to filter out invisible report actions in ReportActionsList for mostRecentAction in ReportScreen as we want only to show most recent action if it is going to be visible inside report action list.

const isVisible =
        !!mostRecentReportAction &&
        (isOffline ||
            ReportActionsUtils.isDeletedParentAction(mostRecentReportAction) ||
            mostRecentReportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ||
            mostRecentReportAction.errors) &&
        ReportActionsUtils.shouldReportActionBeVisible(mostRecentReportAction, mostRecentReportAction.reportActionID);
    const shouldShowMostRecentReportAction =
        !!mostRecentReportAction &&
        !isSingleExpenseReport &&
        !isSingleInvoiceReport &&
        !ReportActionsUtils.isActionOfType(mostRecentReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED) &&
        !ReportActionsUtils.isDeletedAction(mostRecentReportAction) &&
        !!isVisible;

We can obviously create a util function to re-use it in both instance to make it DRY We can also remove isDeletedAction check as the check already exists in shouldReportActionBeVisible

What alternative solutions did you explore? (Optional)

FitseTLT commented 33 minutes ago

To easily reproduce it you can Troubleshoot > clear cache and immediately open the archive expense chat 👍