1+ import { personalDetailsSelector } from '@selectors/PersonalDetails' ;
12import React from 'react' ;
2- import type { OnyxEntry } from 'react-native-onyx' ;
33import Text from '@components/Text' ;
44import useLocalize from '@hooks/useLocalize' ;
55import useOnyx from '@hooks/useOnyx' ;
66import useThemeStyles from '@hooks/useThemeStyles' ;
77import { getPersonalDetailByEmail } from '@libs/PersonalDetailsUtils' ;
8+ import CONST from '@src/CONST' ;
89import ONYXKEYS from '@src/ONYXKEYS' ;
9- import type * as OnyxTypes from '@src/types/onyx' ;
1010
1111type DelegateOnBehalfOfTextProps = {
1212 /** The account ID whose login drives the "on behalf of" name. */
@@ -19,9 +19,7 @@ type DelegateOnBehalfOfTextProps = {
1919function DelegateOnBehalfOfText ( { mainAccountID, fallbackLogin} : DelegateOnBehalfOfTextProps ) {
2020 const styles = useThemeStyles ( ) ;
2121 const { translate} = useLocalize ( ) ;
22- const [ resolvedDetail ] = useOnyx ( ONYXKEYS . PERSONAL_DETAILS_LIST , {
23- selector : ( list : OnyxEntry < OnyxTypes . PersonalDetailsList > ) => ( mainAccountID ? list ?. [ mainAccountID ] : undefined ) ,
24- } ) ;
22+ const [ resolvedDetail ] = useOnyx ( ONYXKEYS . PERSONAL_DETAILS_LIST , { selector : personalDetailsSelector ( mainAccountID ?? CONST . DEFAULT_NUMBER_ID ) } ) ;
2523 const mainAccountLogin = resolvedDetail ?. login ?? fallbackLogin ;
2624 const accountOwnerDetails = getPersonalDetailByEmail ( String ( mainAccountLogin ?? '' ) ) ;
2725 return < Text style = { [ styles . chatDelegateMessage ] } > { translate ( 'delegate.onBehalfOfMessage' , accountOwnerDetails ?. displayName ?? '' ) } </ Text > ;
0 commit comments