From c40e883031be55fddb2e3d3648ed8658e3dd0508 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Fri, 4 Oct 2024 11:47:09 -0700 Subject: [PATCH 1/3] Revert "fix: migrate withFullTransactionOrNotFound to useOnyx" --- .../step/withFullTransactionOrNotFound.tsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx b/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx index 0ddddf7ff878..491c37c9a402 100644 --- a/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx +++ b/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx @@ -2,8 +2,8 @@ import type {RouteProp} from '@react-navigation/native'; import {useIsFocused} from '@react-navigation/native'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; -import {useOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import * as IOUUtils from '@libs/IOUUtils'; @@ -38,25 +38,14 @@ type MoneyRequestRouteName = | typeof SCREENS.MONEY_REQUEST.STEP_SEND_FROM | typeof SCREENS.MONEY_REQUEST.STEP_COMPANY_INFO; -type Route = RouteProp; +type Route = RouteProp; -type WithFullTransactionOrNotFoundProps = WithFullTransactionOrNotFoundOnyxProps & { - route: Route; -}; +type WithFullTransactionOrNotFoundProps = WithFullTransactionOrNotFoundOnyxProps & {route: Route}; -export default function , TRef>( - WrappedComponent: ComponentType>, -): React.ComponentType & RefAttributes> { +export default function , TRef>(WrappedComponent: ComponentType>) { // eslint-disable-next-line rulesdir/no-negated-variables - function WithFullTransactionOrNotFound(props: Omit, ref: ForwardedRef) { - const {route} = props; - const transactionID = route.params.transactionID ?? -1; - const userAction = 'action' in route.params && route.params.action ? route.params.action : CONST.IOU.ACTION.CREATE; - - const shouldUseTransactionDraft = IOUUtils.shouldUseTransactionDraft(userAction); - - const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`); - const [transactionDraft] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`); + function WithFullTransactionOrNotFound(props: TProps, ref: ForwardedRef) { + const transactionID = props.transaction?.transactionID; const isFocused = useIsFocused(); @@ -70,8 +59,7 @@ export default function ); @@ -79,7 +67,19 @@ export default function , WithFullTransactionOrNotFoundOnyxProps>({ + transaction: { + key: ({route}) => { + const transactionID = route.params.transactionID ?? -1; + const userAction = 'action' in route.params && route.params.action ? route.params.action : CONST.IOU.ACTION.CREATE; + + if (IOUUtils.shouldUseTransactionDraft(userAction)) { + return `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}` as `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`; + } + return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; + }, + }, + })(forwardRef(WithFullTransactionOrNotFound)); } export type {WithFullTransactionOrNotFoundProps}; From abe4f3a5bf88f2b9f68afed13e13dd0cd7f95fe8 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Fri, 4 Oct 2024 12:05:12 -0700 Subject: [PATCH 2/3] disable deprecation warning --- src/pages/iou/request/step/withFullTransactionOrNotFound.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx b/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx index 491c37c9a402..66736dc80b52 100644 --- a/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx +++ b/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx @@ -66,7 +66,7 @@ export default function , WithFullTransactionOrNotFoundOnyxProps>({ transaction: { key: ({route}) => { From 58fc7b2b8a22351a5478ed2698f6469994794892 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Fri, 4 Oct 2024 12:09:38 -0700 Subject: [PATCH 3/3] fix import warning --- src/components/ReportActionItem/TaskPreview.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ReportActionItem/TaskPreview.tsx b/src/components/ReportActionItem/TaskPreview.tsx index eb780311f087..187dfbafa5c4 100644 --- a/src/components/ReportActionItem/TaskPreview.tsx +++ b/src/components/ReportActionItem/TaskPreview.tsx @@ -7,6 +7,7 @@ import Avatar from '@components/Avatar'; import Checkbox from '@components/Checkbox'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; +import iconWrapperStyle from '@components/Icon/IconWrapperStyles'; import {usePersonalDetails} from '@components/OnyxProvider'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; import RenderHTML from '@components/RenderHTML';