Migrate MoneyRequestConfirmationList to useOnyx#50848
Migrate MoneyRequestConfirmationList to useOnyx#50848NJ-2020 wants to merge 5 commits intoExpensify:mainfrom NJ-2020:fix/50532
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.
Can you check why this memo is being used here?
There was a problem hiding this comment.
@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
if the transaction value change we will re-render the component
There was a problem hiding this comment.
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.
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.
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.
@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.
I don't think they have done it correctly.
There was a problem hiding this comment.
Can you remove the memo since it is not being used? It will be auto optimized by RN.
|
@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.
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 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
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