-
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
Migrate MoneyRequestConfirmationList to useOnyx #50848
Conversation
@shubham1206agra 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] |
export default memo( | ||
MoneyRequestConfirmationList, | ||
(prevProps, nextProps) => | ||
lodashIsEqual(prevProps.transaction, nextProps.transaction) && | ||
prevProps.onSendMoney === nextProps.onSendMoney && | ||
prevProps.onConfirm === nextProps.onConfirm && | ||
prevProps.iouType === nextProps.iouType && | ||
prevProps.iouAmount === nextProps.iouAmount && | ||
prevProps.isDistanceRequest === nextProps.isDistanceRequest && | ||
prevProps.isPolicyExpenseChat === nextProps.isPolicyExpenseChat && | ||
prevProps.iouCategory === nextProps.iouCategory && | ||
prevProps.shouldShowSmartScanFields === nextProps.shouldShowSmartScanFields && | ||
prevProps.isEditingSplitBill === nextProps.isEditingSplitBill && | ||
prevProps.iouCurrencyCode === nextProps.iouCurrencyCode && | ||
prevProps.iouMerchant === nextProps.iouMerchant && | ||
lodashIsEqual(prevProps.selectedParticipants, nextProps.selectedParticipants) && | ||
lodashIsEqual(prevProps.payeePersonalDetails, nextProps.payeePersonalDetails) && | ||
prevProps.isReadOnly === nextProps.isReadOnly && | ||
prevProps.bankAccountRoute === nextProps.bankAccountRoute && | ||
prevProps.policyID === nextProps.policyID && | ||
prevProps.reportID === nextProps.reportID && | ||
prevProps.receiptPath === nextProps.receiptPath && | ||
prevProps.iouComment === nextProps.iouComment && | ||
prevProps.receiptFilename === nextProps.receiptFilename && | ||
prevProps.iouCreated === nextProps.iouCreated && | ||
prevProps.iouIsBillable === nextProps.iouIsBillable && | ||
prevProps.onToggleBillable === nextProps.onToggleBillable && | ||
prevProps.hasSmartScanFailed === nextProps.hasSmartScanFailed && | ||
prevProps.reportActionID === nextProps.reportActionID && | ||
lodashIsEqual(prevProps.action, nextProps.action) && | ||
prevProps.shouldDisplayReceipt === nextProps.shouldDisplayReceipt, |
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 check why this memo is being used here?
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.
@shubham1206agra We use memo here to prevent the component from being rendered to many times and we will re-render the component if the prevProps and nextProps value change i.e
lodashIsEqual(prevProps.transaction, nextProps.transaction) && |
if the transaction value change we will re-render the component
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.
Friendly bump @shubham1206agra
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 since we changed to hook now, it will start to re-render again. We need to stop 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.
since we changed to hook now, it will start to re-render again. We need to stop this.
Can you explain please what do you mean by that?
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 remove the memo checks because it's coming from withOnyx which is already migrated to useOnyx so we don't need it again
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.
@shubham1206agra I think we can close this PR because it's already have been migrated to useOnyx here
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 don't think they have done it correctly.
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 remove the memo since it is not being used? It will be auto optimized by RN.
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
@NJ-2020 Can you merge main otherwise it will fail tests? |
@shubham1206agra Done |
@NJ-2020 Please add the tests. |
@NJ-2020 Can you again merge main? Since the PR got reverted |
@shubham1206agra Sorry for the delay, Okay will do |
@shubham1206agra Done |
Bump @shubham1206agra for reviewer checklist |
@shubham1206agra Done updated |
Bump @shubham1206agra ^ |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-11-10.at.9.34.54.PM.movAndroid: mWeb ChromeScreen.Recording.2024-11-10.at.9.13.02.PM.moviOS: NativeScreen.Recording.2024-11-10.at.9.31.15.PM.moviOS: mWeb SafariScreen.Recording.2024-11-10.at.9.08.49.PM.movMacOS: Chrome / SafariScreen.Recording.2024-11-10.at.9.06.29.PM.movMacOS: DesktopScreen.Recording.2024-11-10.at.9.21.39.PM.mov |
@neil-marcellini Bump here |
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.
Sorry for the delay in reviewing, I was on a backpacking trip last week.
It looks like this component was already migrated to useOnyx, so can we just close the PR and issue? I think so. It looks like the only difference is that you're changing the defaultID values and removing the memo.
I understand that we use the React compiler so it should be ok to remove the memo, but I checked with dev tools and I don't see the Memo ✨ badge next to the component so according the docs that means it's not optimized. Therefore we should leave the memo in and I think we can just close this PR.
@neil-marcellini Leaving the memo in is not required since it will just add some extra overhead on the component. |
Details
Fixed Issues
$ #50532
PROPOSAL: #50532 (comment)
Tests
Offline tests
Same as Tests
QA Steps
Same as Tests
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
Screen.Recording.2024-11-01.at.02.56.22.mov
Android: mWeb Chrome
Screen.Recording.2024-11-01.at.20.28.59.mov
iOS: Native
Screen.Recording.2024-11-01.at.00.24.16.mov
iOS: mWeb Safari
Screen.Recording.2024-11-01.at.00.46.03.mov
MacOS: Chrome / Safari
Screen.Recording.2024-11-01.at.01.30.02.mov
MacOS: Desktop
Screen.Recording.2024-11-01.at.01.44.11.mov