11import React from 'react' ;
22import { View } from 'react-native' ;
33import type { OnyxCollection , OnyxEntry } from 'react-native-onyx' ;
4+ import { usePersonalDetails } from '@components/OnyxListItemProvider' ;
45import useOnyx from '@hooks/useOnyx' ;
56import useThemeStyles from '@hooks/useThemeStyles' ;
67import { getOriginalMessage , getReportAction , isMoneyRequestAction } from '@libs/ReportActionsUtils' ;
78import { getOriginalReportID } from '@libs/ReportUtils' ;
89import ReportActionItem from '@pages/home/report/ReportActionItem' ;
910import CONST from '@src/CONST' ;
1011import ONYXKEYS from '@src/ONYXKEYS' ;
11- import type { Policy , Report , ReportActionsDrafts , Transaction } from '@src/types/onyx' ;
12+ import type { Policy , Report , Transaction } from '@src/types/onyx' ;
1213
1314type DuplicateTransactionItemProps = {
1415 transaction : OnyxEntry < Transaction > ;
@@ -22,7 +23,7 @@ function DuplicateTransactionItem({transaction, index, allReports, policies}: Du
2223 const styles = useThemeStyles ( ) ;
2324 const [ userWallet ] = useOnyx ( ONYXKEYS . USER_WALLET , { canBeMissing : true } ) ;
2425 const [ isUserValidated ] = useOnyx ( ONYXKEYS . ACCOUNT , { selector : ( account ) => account ?. validated , canBeMissing : true } ) ;
25- const [ personalDetails ] = useOnyx ( ONYXKEYS . PERSONAL_DETAILS_LIST , { canBeMissing : true } ) ;
26+ const personalDetails = usePersonalDetails ( ) ;
2627 const [ userBillingFundID ] = useOnyx ( ONYXKEYS . NVP_BILLING_FUND_ID , { canBeMissing : true } ) ;
2728 const report = allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ transaction ?. reportID } ` ] ;
2829 const [ reportActions ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ report ?. reportID } ` , { canBeMissing : false } ) ;
@@ -52,6 +53,9 @@ function DuplicateTransactionItem({transaction, index, allReports, policies}: Du
5253 return null ;
5354 }
5455
56+ const reportDraftMessage = draftMessage ?. [ action . reportActionID ] ;
57+ const matchingDraftMessage = typeof reportDraftMessage === 'string' ? reportDraftMessage : reportDraftMessage ?. message ;
58+
5559 return (
5660 < View style = { styles . pb2 } >
5761 < ReportActionItem
@@ -70,7 +74,7 @@ function DuplicateTransactionItem({transaction, index, allReports, policies}: Du
7074 userWallet = { userWallet }
7175 isUserValidated = { isUserValidated }
7276 personalDetails = { personalDetails }
73- draftMessage = { draftMessage as OnyxEntry < string & ReportActionsDrafts > }
77+ draftMessage = { matchingDraftMessage }
7478 emojiReactions = { emojiReactions }
7579 linkedTransactionRouteError = { linkedTransactionRouteError }
7680 userBillingFundID = { userBillingFundID }
0 commit comments