-
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 bug with Payment option is not selected #49345
Fix bug with Payment option is not selected #49345
Conversation
@dukenv0307 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] |
I'm reviewing... |
@ZhenjaHorbach Should we remove these lines? I see you mentioned it in your proposal. I notice that the initial App/src/components/SettlementButton/index.tsx Lines 152 to 155 in 266ad46
|
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-09-18.at.10.55.30.movAndroid: mWeb ChromeScreen.Recording.2024-09-18.at.10.53.29.moviOS: NativeScreen.Recording.2024-09-18.at.10.56.36.moviOS: mWeb SafariScreen.Recording.2024-09-18.at.10.52.27.movMacOS: Chrome / SafariScreen.Recording.2024-09-18.at.10.49.37.movMacOS: DesktopScreen.Recording.2024-09-18.at.11.00.01.mov |
LGTM, just left one minor comment |
Besides, there's one ESlint failed, but I don't think we should fix here cc @mountiny |
I thought about it |
And I agree ! |
Thank you @ZhenjaHorbach, I've tested your PR and it looks good |
@@ -62,12 +62,14 @@ function SettlementButton({ | |||
const {isOffline} = useNetwork(); | |||
// The app would crash due to subscribing to the entire report collection if chatReportID is an empty string. So we should have a fallback ID here. | |||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || -1}`); | |||
const [lastPaymentMethod = '-1'] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD, {selector: (paymentMethod) => paymentMethod?.[policyID]}); | |||
const [nvpLastPaymentMethod] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD); | |||
const nvpLastPaymentMethodIsInitialized = nvpLastPaymentMethod !== undefined; |
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.
Can you explain this change?
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.
The purpose of these changes was to make sure that we only update the Options list by PaymentMethod when we have a PaymentMethod initialized (when it changes from undefined to object )
Other times we don't do this
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 think we should use a build in feature of useOnyx to handle this if we want https://github.com/Expensify/App/blob/b7c0055c531f668c683cc048cb01f6f6afc33f97/src/pages/home/ReportScreen.tsx#L135C5-L135C66
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.
Yes
It works the same as comparing with undefined
But looks cleaner !
Thanks
@mountiny @dukenv0307 |
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.
Changes look good to me but if you are available, I would prefer to change this so we can use the built in onyx feature
@@ -62,12 +62,14 @@ function SettlementButton({ | |||
const {isOffline} = useNetwork(); | |||
// The app would crash due to subscribing to the entire report collection if chatReportID is an empty string. So we should have a fallback ID here. | |||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || -1}`); | |||
const [lastPaymentMethod = '-1'] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD, {selector: (paymentMethod) => paymentMethod?.[policyID]}); | |||
const [nvpLastPaymentMethod] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD); | |||
const nvpLastPaymentMethodIsInitialized = nvpLastPaymentMethod !== undefined; |
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 think we should use a build in feature of useOnyx to handle this if we want https://github.com/Expensify/App/blob/b7c0055c531f668c683cc048cb01f6f6afc33f97/src/pages/home/ReportScreen.tsx#L135C5-L135C66
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 you!
Not going to do the migration in this PR |
@mountiny looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
We opted not to migrate these files to |
✋ 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/mountiny in version: 9.0.38-0 🚀
|
🚀 Deployed to production by https://github.com/grgia in version: 9.0.38-4 🚀
|
Details
Fix bug with Payment option is not selected
Fixed Issues
$ #49331
PROPOSAL: #49331 (comment)
Tests
Precondition:
Workspace has set up bank account.
Offline tests
Precondition:
Workspace has set up bank account.
QA Steps
Precondition:
Workspace has set up bank account.
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.mov
Android: mWeb Chrome
android-web.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov