Fix all offline created transaction is deleted when we delete one of the transaction#27306
Conversation
|
@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
The issue also happens on split bill, so I fixed it too. Screen.Recording.2023-09-13.at.13.46.25.mov |
| // The CREATED action should not be created after the IOU action | ||
| expect(Date.parse(createdAction.created)).toBeLessThanOrEqual(Date.parse(iouAction.created)); | ||
| expect(Date.parse(createdAction.created)).toBeLessThan(Date.parse(iouAction.created)); | ||
|
|
There was a problem hiding this comment.
Fortunately we already have the unit test, but it uses toBeLessThanOrEqual, so I changed it to toBeLessThan.
| // The CREATED action should not be created after the IOU action | ||
| expect(Date.parse(createdAction.created)).toBeLessThanOrEqual(Date.parse(iouAction.created)); | ||
| expect(Date.parse(iouCreatedAction.created)).toBeLessThan(Date.parse(iouAction.created)); | ||
|
|
There was a problem hiding this comment.
I changed it from createdAction to iouCreatedAction because createdAction is the CREATED action of the chat report, not the iou report, otherwise it will fail.
| expect(julesIOUAction.originalMessage.type).toBe(CONST.IOU.REPORT_ACTION_TYPE.CREATE); | ||
| expect(Date.parse(julesCreatedAction.created)).toBeLessThanOrEqual(Date.parse(julesIOUAction.created)); | ||
| expect(Date.parse(julesIOUCreatedAction.created)).toBeLessThan(Date.parse(julesIOUAction.created)); | ||
|
|
There was a problem hiding this comment.
Same reason as above
| expect(carlosIOUAction.originalMessage.type).toBe(CONST.IOU.REPORT_ACTION_TYPE.CREATE); | ||
| expect(Date.parse(carlosCreatedAction.created)).toBeLessThanOrEqual(Date.parse(carlosIOUAction.created)); | ||
| expect(Date.parse(carlosIOUCreatedAction.created)).toBeLessThan(Date.parse(carlosIOUAction.created)); | ||
|
|
There was a problem hiding this comment.
Same reason as above
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-10-12.at.17.57.45.movMobile Web - Chromescreen-20231012-202624.mp4Mobile Web - SafariScreen.Recording.2023-10-12.at.20.19.24.movDesktopScreen.Recording.2023-10-12.at.20.29.43.moviOSScreen.Recording.2023-10-12.at.20.15.47.movAndroidscreen-20231012-205544.mp4 |
eVoloshchak
left a comment
There was a problem hiding this comment.
Bug:
- Open any chat without outstanding IOU
- Turn off the internet connection
- Request money from the chat twice
- Click the request preview to open IOU report
- Delete the second request/transaction
- Verify the second request is pending delete (currently, the pending delete shows a skeleton, there is an issue for this, but I forgot the link)
- Verify the IOU report and other request/transaction is not deleted
- Turn the internet back again
- Notice the IOU report still says "2 requests"
- Click the request preview to open IOU report, notice you're presented with
Hmm... it's not herepage and the IOU report disappears from LHN
Screen.Recording.2023-09-15.at.14.05.07.mov
|
@eVoloshchak it's most likely a BE issue. When you logout and login back, you will see the (undefined) iou disappears from the chat. The only guess I have is, on the BE, the whole IOU report is deleted when we delete the 2nd transaction. We are fixing this in the FE, but looks like the same issue happened on BE? The root cause could be different because the delete money request only send Lines 1376 to 1383 in 83b3f5d The sequence of the request is: and somehow the Delete Money Request 2 delete the whole IOU on the BE. |
|
@eVoloshchak I totally forgot about this PR. I just retested and looks like the BE issue is resolved. Can you retest it to make sure it is fixed? Screen.Recording.2023-10-12.at.14.56.11.mov |
|
@bernhardoj, I can see 2 issues with this
|
|
|
@bernhardoj, I was incorrect about the "go back to the original chat" part, it's updated when you go back online (the delay confused me) Screen.Recording.2023-10-12.at.16.15.17.mov |
|
Actually, looks like this has been already resolved in prod, @bernhardoj, could you double-check that, please? Screen.Recording.2023-10-12.at.16.23.44.mov |
|
@eVoloshchak You need to create the request while offline Screen.Recording.2023-10-12.at.22.29.51.mov |
|
@bondydaa, gentle bump on this |
|
@bondydaa ready for your review |
|
@bondydaa gentle bump |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/bondydaa in version: 1.3.92-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.92-4 🚀
|
|
🚀 Deployed to staging by https://github.com/bondydaa in version: 1.3.93-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.93-1 🚀
|
Details
Deleting one transaction will delete the whole iou that is optimistically created while offline.
Fixed Issues
$ #24366
PROPOSAL: #24366 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Screen.Recording.2023-09-13.at.13.07.02.mov
Mobile Web - Chrome
Screen.Recording.2023-09-13.at.13.14.13.mov
Mobile Web - Safari
Screen.Recording.2023-09-13.at.13.15.37.mov
Desktop
Screen.Recording.2023-09-13.at.13.09.27.mov
iOS
Screen.Recording.2023-09-13.at.13.16.21.mov
Android
Screen.Recording.2023-09-13.at.13.10.29.mov