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.51k stars 2.86k forks source link

[Offline] Group chat - Group chat turns to not here page when creating group with non-existing account #51473

Open lanitochka17 opened 6 days ago

lanitochka17 commented 6 days 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.54-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): applausetester+kh2010001@applause.expensifail.com Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go offline
  3. Go to FAB > Start chat
  4. Enter any random gmail account (non-existing account)
  5. Click Add to group
  6. Start a group with the user
  7. Go online

Expected Result:

Group chat will not turn to not here page after returning online

Actual Result:

Group chat turns to not here page after creating group chat with non-existing account offline and returning online

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/91c0f9a6-a447-41f8-9f46-4faff5cb2d3e

View all open jobs on GitHub

melvin-bot[bot] commented 6 days ago

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

lanitochka17 commented 6 days ago

@mallenexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

NJ-2020 commented 4 days ago

Edited by proposal-police: This proposal was edited at 2024-10-27 14:23:02 UTC.

Proposal

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

Group chat - Group chat turns to not here page when creating group with non-existing account

What is the root cause of that problem?

It shows 404 page not found because we did not pass the emailList value when requesting to the OpenReport API after change from offline to online Screenshot 2024-10-27 at 07 08 36 It's because when we go to offline mode and create new group, the OpenReport API get called 2 times, first when creating the group and second when opening the group chat https://github.com/Expensify/App/blob/652d2ffa1b099f9c5a1f0cdce780792097f736ad/src/pages/NewChatConfirmPage.tsx#L101-L108 After this PR #51093 we will replace duplicated OpenReport requests if the request.command and the report id is equal meaning it will replace the previous request with the new one (when opening group chat) which will remove the emailList value (from the previous request createGroup) https://github.com/Expensify/App/blob/652d2ffa1b099f9c5a1f0cdce780792097f736ad/src/libs/actions/Report.ts#L982-L983

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

We should check also for emailList if the previous request and current request is same We can check also for other param like accountIDList if needed

API.paginate(CONST.API_REQUEST_TYPE.WRITE, WRITE_COMMANDS.OPEN_REPORT, parameters, {optimisticData, successData, failureData}, paginationConfig, {
    checkAndFixConflictingRequest: (persistedRequests) =>
        resolveDuplicationConflictAction(persistedRequests, (request) => request.command === WRITE_COMMANDS.OPEN_REPORT && request.data?.reportID === reportID && request.data?.emailList ===  parameters.emailList),
});

Result

https://github.com/user-attachments/assets/9afd5a6c-940f-4ad6-add4-e93a1703d497

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 3 days ago

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

MelvinBot commented 2 days ago

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

mallenexpensify commented 2 days ago

@NJ-2020 thanks for the proposal. I'm unsure exactly what I want to do with the issue so I added Needs Reproduction and Weekly. We're shifting internal priorities and I'm unsure where 'offline' issues fall into that.

NJ-2020 commented 2 days ago

Okay no problem, thank you