-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when create new chat in offline mode #23439
Comments
Triggered auto assignment to @garrettmknight ( |
Bug0 Triage Checklist (Main S/O)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.When we create a chat multiple times with the same user offline, it creates multiple times the chat instead of opening the existing one What is the root cause of that problem?In Report, when we check if an existing chat exist we call getChatByParticipantsByLoginList here: App/src/libs/actions/Report.js Line 532 in cd851d0
In this method we check if the report has a field particpantsAccountIDs that is not empty, we also check if the report has the same participants than the participants of the chat we want to create here: Lines 2216 to 2221 in cd851d0
Those two conditions are not met because when we create a chat offline the method here: App/src/libs/actions/Report.js Lines 534 to 535 in cd851d0
We retrieve the list of account ids of the participants by searching the logins in personalDetails. For a new chat this will return an empty list. So the participantsList that we pass to buildOptimisticChatReport will be empty here: Line 1728 in cd851d0
What changes do you think we should make in order to solve the problem?In the buildOptimisticChatReport we need to set the field "participants" that is not set so far, we can pass the logins of the users to the method. Then in getChatByParticipantsByLoginList here: Line 2216 in cd851d0
instead of checking if the particpantsAccountIDs are empty we can check if the participants field is empty Result: 2023-07-23.20-47-09.mp4What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Error when create new chat in offline mode What is the root cause of that problem?When we create a report. Optimistic data is created without Line 1728 in cd851d0
It's only returned by BE, so when we search again in offline mode, we cannot find the report by using App/src/libs/actions/Report.js Line 532 in cd851d0
What changes do you think we should make in order to solve the problem?I know we remove all use of
Line 1728 in cd851d0
Line 1742 in cd851d0
App/src/libs/actions/Report.js Lines 534 to 535 in cd851d0
What alternative solutions did you explore? (Optional) |
I believe this will get fixed by this PR: #22147 |
@puneetlath If I understand correctly the api will return the first chat created for that user and we delete the next ones right ? What happens to the messages sent offline in the "not first chats"? |
@DinalJivani @kavimuru couldn't reproduce on 1.3.45 - specifically, I couldn't get a second chat to open for the same user. When I selected the same user for a second time in the new chat menu it reopened the original chat. |
I still reproduce on staging 1.3.45.3 2023-07-25.09-50-28.mp4Are you offline ? Are you creating two chats with a user you have never chat before ? |
@ShogunFire do you still experience the error on this branch? #22147 |
Offline you will still see the two chats with that PR Is that a problem ? And that's why I asked that #23439 (comment) |
Ah got it. We are soon going to be getting rid of participants in favor of participantAccountIDs. Will the problem still exist then? |
Yes, we are already not using participants in that case, my proposal was actually to use it lol... |
@garrettmknight @puneetlath RPReplay_Final1693340762.mp4 |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
There should be no error and It should open same chat if selected for second time
Actual Result:
It opens new chat every-time, and show error when go online
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.44-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Image.from.iOS.MP4
MOTT8983.2.MP4
Expensify/Expensify Issue URL:
Issue reported by: @DinalJivani
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690057959260379
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: