-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: prevent editing money request in case create failure #46376
fix: prevent editing money request in case create failure #46376
Conversation
Little bit confused about the last three testing steps:
As we're disabling editing the request until the error (and request) are dismissed. |
Sorry @Ollyws. I updated the test steps. |
@dominictb It seems that editing is disabled on all requests: Screen.Recording.2024-07-30.at.11.56.41.mov |
@Ollyws this doesn't look right. Lemme check and get back to you later. |
@Ollyws sorry, I might mistakenly put an extra '!'. Remove it now and everything should work fine. |
Reviewer Checklist
Screenshots/VideosAndroid: Native01_Android_Native.mp4Android: mWeb Chrome02_Android_Chrome.mp4iOS: Native03_iOS_Native.mp4iOS: mWeb Safari04_iOS_Safari.mp4MacOS: Chrome / Safari05_MacOS_Chrome.mp4MacOS: Desktop06_MacOS_Desktop.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.
LGTM.
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.
Thank for the fix, I think it all looks pretty good. I added some non blocking suggestions, which you could address in a follow up if you like. If so please DM me on Slack so I can review.
@@ -2733,6 +2733,11 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry<ReportAction<typeof | |||
return false; | |||
} | |||
|
|||
const transaction = linkedTransaction ?? getLinkedTransaction(reportAction ?? undefined); | |||
if (!transaction?.transactionID || (transaction?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD && !isEmptyObject(transaction.errors))) { |
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.
NAB: It would capture the intent better and be easier to read if we extract the if statement condition into a variable called transactionFailedToCreate
. Alternatively we could explain with a comment.
const originalMessage = parentReportAction && ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction) : undefined; | ||
return originalMessage?.IOUTransactionID ?? '-1'; | ||
}, [parentReportAction]); | ||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`); |
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.
NAB: To match the previous behavior using withOnyx should we render null if the transaction status is loading from Onyx?
✋ 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/neil-marcellini in version: 9.0.15-4 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.15-9 🚀
|
Details
Fixed Issues
$ #44459
PROPOSAL: #44459 (comment)
Tests
X
icon to clear the errorVerify that: After step 8, the user couldn't edit the money request. After step 9, the errored money request is cleaned up properly and the user is navigated back to the relevant report screen
Offline tests
QA Steps
X
icon to clear the errorVerify that: After step 8, the user couldn't edit the money request. After step 9, the errored money request is cleaned up properly and the user is navigated back to the relevant report screen
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
compressed_android.mov.mp4
Android: mWeb Chrome
compressed_android.mov.mp4
iOS: Native
compressed_ios.mov.mp4
iOS: mWeb Safari
compressed_ios.mov.mp4
MacOS: Chrome / Safari
compressed_web.mov.mp4
MacOS: Desktop
compressed_web.mov.mp4