Refactor how data is loaded into the edit request page#28645
Conversation
|
@pecanoro bump for review please |
| }, | ||
| }), | ||
| // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file | ||
| withOnyx({ |
There was a problem hiding this comment.
Why not combining both withOnyx? I am reading this and I am not totally sure why they can't be combined.
There was a problem hiding this comment.
I'm glad you caught that! Basically, it can't be done until Expensify/react-native-onyx#385 is merged and implemented.
There was a problem hiding this comment.
Gotcha! Thank you for clarifying!
Reviewer Checklist
Screenshots/Videos |
|
Testing in all platforms before merging! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
@pecanoro I'm getting an error when trying to access the report sub-page via deep link. Try accessing deeplink after logout (imp) |
| const parentReportAction = ReportActionsUtils.getParentReportAction(report); | ||
| const transaction = TransactionUtils.getLinkedTransaction(parentReportAction); | ||
| function EditRequestPage({betas, report, route, parentReport, policy, session, policyCategories, policyTags, parentReportActions, transaction}) { | ||
| const parentReportAction = parentReportActions[report.parentReportActionID]; |
There was a problem hiding this comment.
Maybe we can use lodashGet function here to fetch parentReportAction.
There was a problem hiding this comment.
Yeah, we could. Ideally, this would be done in the withOnyx selector for the key parentReportActions. When I am able to remove the withOnyx nesting, I would like to:
- Remove this
const parentReportAction - Rename
parentReportActionsprop toparentReportAction - Update the
transactionprop to useparentReportAction
parentReportAction: {
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '0'}`,
selector: (parentReportActions, {report}) => {lodashGet(parentReportActions, [report.parentReportActionID])},
canEvict: false,
},
transaction: {
key: ({parentReportAction}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(parentReportAction, 'originalMessage.IOUTransactionID', 0)}`,
},
This will be possible once Expensify/react-native-onyx#385 is merged.
|
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.3.80-0 🚀
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.80-3 🚀
|
|
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.3.81-0 🚀
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
2 similar comments
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|






Details
This PR removes two deprecated function calls and moves the data loading into
withOnyxFixed Issues
Part of #27262
Tests
Offline tests
Same
QA Steps
Same
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android