-
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 inconsistency in dismissing report details RHP when deleting expense with comments #44777
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
@@ -633,7 +636,13 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD | |||
isVisible={isDeleteModalVisible} | |||
onConfirm={deleteTransaction} | |||
onCancel={() => setIsDeleteModalVisible(false)} | |||
onModalHide={() => ReportUtils.navigateBackAfterDeleteTransaction(navigateBackToAfterDelete.current)} | |||
onModalHide={() => { | |||
if (isTransactionDeleted.current && !navigateBackToAfterDelete.current) { |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Done
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 |
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.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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
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