File tree 1 file changed +7
-1
lines changed
src/apps/learn/src/tca-certificate/user-certification-view
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 5
5
SetStateAction ,
6
6
useEffect ,
7
7
useLayoutEffect ,
8
+ useMemo ,
8
9
useRef ,
9
10
useState ,
10
11
} from 'react'
@@ -44,6 +45,11 @@ const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: Us
44
45
const isOwnProfile : boolean = ! ! props . profile ?. email
45
46
46
47
const isModalView : boolean = queryParams . get ( 'view-style' ) === 'modal'
48
+ const userName = useMemo ( ( ) => (
49
+ ! ! ( props . profile ?. firstName || props . profile ?. lastName )
50
+ ? `${ props . profile . firstName } ${ props . profile . lastName } `
51
+ : props . enrollment ?. userName
52
+ ) , [ props . profile , props . enrollment ] )
47
53
48
54
const [ isMemberVerified , setIsMemberVerified ] : [ boolean , Dispatch < SetStateAction < boolean > > ]
49
55
= useState < boolean > ( false )
@@ -95,7 +101,7 @@ const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: Us
95
101
completionUuid = { props . enrollment . completionUuid ?? undefined }
96
102
isMemberVerified = { isMemberVerified }
97
103
userProfile = { props . profile }
98
- userName = { props . enrollment . userName }
104
+ userName = { userName }
99
105
isOwner = { isOwnProfile }
100
106
validationUrl = { validationUrl }
101
107
isPreview = { props . isPreview }
You can’t perform that action at this time.
0 commit comments