Fix inconsistency in dismissing report details RHP when deleting expense with comments#44777
Conversation
|
Closing the modal when the expense is deleted is being handled in #44537 |
src/pages/ReportDetailsPage.tsx
Outdated
| onCancel={() => setIsDeleteModalVisible(false)} | ||
| onModalHide={() => ReportUtils.navigateBackAfterDeleteTransaction(navigateBackToAfterDelete.current)} | ||
| onModalHide={() => { | ||
| if (isTransactionDeleted.current && !navigateBackToAfterDelete.current) { |
There was a problem hiding this comment.
I am not sure why we need to introduce isTransactionDeleted.current. Wouldn't this work with just the support of navigateBackToAfterDelete.current? Or is there a use case which will fail if we don't use isTransactionDeleted.current?
There was a problem hiding this comment.
Wouldn't this work with just the support of navigateBackToAfterDelete.current?
Sorry, I don't quite understand this. Do you mean to just check if (!navigateBackToAfterDelete.current) {?
There was a problem hiding this comment.
Wouldn't this work with just the support of navigateBackToAfterDelete.current?
Sorry, I don't quite understand this. Do you mean to just check
if (!navigateBackToAfterDelete.current) {?
Yes. That's correct. Looks like I needed to make this a little more clear in communication. I am curious to know a use case that would fail if we just check if (!navigateBackToAfterDelete.current) {.
There was a problem hiding this comment.
It will close the page when we close the modal without deleting the transaction (for example pressing the backdrop/overlay).
There was a problem hiding this comment.
It will close the page when we close the modal without deleting the transaction (for example pressing the backdrop/overlay).
Ah! Ok. That makes sense. Since the purpose of isTransactionDeleted is not very obvious due to the presence of navigateBackToAfterDelete, can you please add relevant comments to the code to reflect the purpose of isTransactionDeleted? I think this will help someone who looks at this code later.
|
Thanks @bernhardoj for the changes. We have an additional lint issue to address related to early return. |
|
Fixed lint. |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safari44777-web-safari-001.mp4MacOS: Desktop44777-desktop-001.mp4Android: Native44777-android-native-001.mp4Android: mWeb Chrome44777-mweb-chrome-001.mp4iOS: Native44777-ios-native-001.mp4iOS: mWeb Safari44777-mweb-safari-001.mp4 |
rojiphil
left a comment
There was a problem hiding this comment.
Thanks @bernhardoj. Code LGTM. And works well too.
@jasperhuangg All yours for review
|
✋ 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/jasperhuangg in version: 9.0.7-3 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 9.0.7-4 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.7-8 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.8-6 🚀
|
Details
When deleting expenses with comments, the details page is closed if we delete a one-transaction report, but not closed if we delete from the transaction thread.
Fixed Issues
$ #44336
PROPOSAL: #44336 (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 methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.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
Android: Native
android.mp4
android.2.mp4
Android: mWeb Chrome
android.mweb.1.mp4
android.mweb.2.mp4
iOS: Native
ios.mp4
ios.2.mp4
iOS: mWeb Safari
ios.1.mp4
ios.2.mp4
MacOS: Chrome / Safari
web.1.mp4
web.2.mp4
MacOS: Desktop
desktop.mp4
desktop.2.mp4