@@ -4,9 +4,9 @@ import isEmpty from 'lodash/isEmpty';
4
4
import React from 'react' ;
5
5
import { StyleSheet } from 'react-native' ;
6
6
import type { TextStyle } from 'react-native' ;
7
+ import { useOnyx } from 'react-native-onyx' ;
7
8
import type { CustomRendererProps , TPhrasing , TText } from 'react-native-render-html' ;
8
9
import { TNodeChildrenRenderer } from 'react-native-render-html' ;
9
- import { usePersonalDetails } from '@components/OnyxProvider' ;
10
10
import { ShowContextMenuContext , showContextMenuForReport } from '@components/ShowContextMenuContext' ;
11
11
import Text from '@components/Text' ;
12
12
import UserDetailsTooltip from '@components/UserDetailsTooltip' ;
@@ -20,6 +20,7 @@ import Navigation from '@libs/Navigation/Navigation';
20
20
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils' ;
21
21
import * as ReportUtils from '@libs/ReportUtils' ;
22
22
import CONST from '@src/CONST' ;
23
+ import ONYXKEYS from '@src/ONYXKEYS' ;
23
24
import ROUTES from '@src/ROUTES' ;
24
25
import type { Route } from '@src/ROUTES' ;
25
26
import asMutable from '@src/types/utils/asMutable' ;
@@ -31,7 +32,7 @@ function MentionUserRenderer({style, tnode, TDefaultRenderer, currentUserPersona
31
32
const styles = useThemeStyles ( ) ;
32
33
const StyleUtils = useStyleUtils ( ) ;
33
34
const htmlAttribAccountID = tnode . attributes . accountid ;
34
- const personalDetails = usePersonalDetails ( ) || CONST . EMPTY_OBJECT ;
35
+ const [ personalDetails ] = useOnyx ( ONYXKEYS . PERSONAL_DETAILS_LIST ) ;
35
36
const htmlAttributeAccountID = tnode . attributes . accountid ;
36
37
37
38
let accountID : number ;
@@ -56,7 +57,7 @@ function MentionUserRenderer({style, tnode, TDefaultRenderer, currentUserPersona
56
57
return displayText . split ( '@' ) . at ( 0 ) ;
57
58
} ;
58
59
59
- if ( ! isEmpty ( htmlAttribAccountID ) ) {
60
+ if ( ! isEmpty ( htmlAttribAccountID ) && personalDetails ?. [ htmlAttribAccountID ] ) {
60
61
const user = personalDetails [ htmlAttribAccountID ] ;
61
62
accountID = parseInt ( htmlAttribAccountID , 10 ) ;
62
63
mentionDisplayText = LocalePhoneNumber . formatPhoneNumber ( user ?. login ?? '' ) || PersonalDetailsUtils . getDisplayNameOrDefault ( user ) ;
0 commit comments