[TS migration] Migrate withFullTransactionOrNotFound HOC#36855
Conversation
|
|
||
| type WithFullTransactionOrNotFoundOnyxProps = { | ||
| /** Indicated whether the report data is loading */ | ||
| transaction: OnyxCollection<Transaction>; |
There was a problem hiding this comment.
| transaction: OnyxCollection<Transaction>; | |
| transaction: OnyxEntry<Transaction>; |
| export default function <TProps extends WithFullTransactionOrNotFoundProps, TRef>(WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>) { | ||
| // eslint-disable-next-line rulesdir/no-negated-variables | ||
| function WithFullTransactionOrNotFound(props: TProps, ref: ForwardedRef<TRef>) { | ||
| const transactionID = props.route.params.transactionID; |
There was a problem hiding this comment.
| const transactionID = props.route.params.transactionID; | |
| const transactionID = props.transaction?.transactionID; |
Let's be cautious with these changes, before the file was getting from props 👀
| key: ({route}) => { | ||
| const transactionID = route.params.transactionID ?? 0; | ||
| const userAction = route.params.action ?? CONST.IOU.ACTION.CREATE; | ||
| return `${userAction === CONST.IOU.ACTION.CREATE ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; |
There was a problem hiding this comment.
| return `${userAction === CONST.IOU.ACTION.CREATE ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; | |
| if (userAction === CONST.IOU.ACTION.CREATE) { | |
| return `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}` as `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`; | |
| } | |
| return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; |
Isn't pretty solution but I'm afraid we don't have other options
| }, | ||
| }, | ||
| })(forwardRef(WithFullTransactionOrNotFound)); | ||
| } |
There was a problem hiding this comment.
| } | |
| } | |
| export type {WithFullTransactionOrNotFoundProps}; |
Also, let's export the type (it will be used in the future)
Reviewer Checklist
Screenshots/VideosAndroid: NativeCleanShot.2024-02-28.at.23.41.25.mp4Android: mWeb ChromeCleanShot.2024-02-28.at.23.44.10.mp4iOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-28.at.23.54.33.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-28.at.23.56.10.mp4MacOS: Chrome / SafariCleanShot.2024-02-28.at.23.20.18.mp4MacOS: DesktopCleanShot.2024-02-28.at.23.52.27.mp4 |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #36123 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
🚀 Deployed to staging by https://github.com/tylerkaraszewski in version: 1.4.46-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.4.46-2 🚀
|
|
Hey @ruben-rebelo This PR was reverted, are you working on this, right? |
|
@fabioh8010 Yes, that is correct! |
|
Any updates @ruben-rebelo ? |
|
Just created an draft pr getting this back with the issue fixes, here is the PR: 38990 |
Details
[TS migration] Migrate *withFullTransactionOrNotFound HOC to TypeScript
Fixed Issues
$ #36123
PROPOSAL: N/A
Tests
Verify that no errors appear in the JS console
Open the app and log in
Navigate to any chat
Press plus and request money
Following the request money process should work as before
Offline tests
N/A
QA Steps
Same as in the Tests section.
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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
8mb.video-2W7-OcZXZfPw.mp4
Android: mWeb Chrome
android-web.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
macos-web.mov
MacOS: Desktop
macos-native.mov