-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix all offline created transaction is deleted when we delete one of the transaction #27306
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 |
@@ -92,7 +92,7 @@ describe('actions/IOU', () => { | |||
iouAction = iouActions[0]; | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fortunately we already have the unit test, but it uses toBeLessThanOrEqual
, so I changed it to toBeLessThan
.
iouAction = _.find(allIOUReportActions, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); | ||
|
||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -1015,7 +1019,7 @@ describe('actions/IOU', () => { | |||
expect(julesIOUAction.originalMessage.amount).toBe(amount / 4); | |||
expect(julesIOUAction.originalMessage.comment).toBe(comment); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reason as above
carlosIOUAction = _.find(carlosReportActions, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); | ||
expect(carlosIOUAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); | ||
expect(carlosIOUAction.originalMessage.IOUReportID).toBe(carlosIOUReport.reportID); | ||
expect(carlosIOUAction.originalMessage.amount).toBe(amount / 4); | ||
expect(carlosIOUAction.originalMessage.comment).toBe(comment); | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 here
page 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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