1- import { Dispatch , SetStateAction , useContext , useEffect , useState } from 'react'
1+ import { Dispatch , SetStateAction , useEffect , useState } from 'react'
22
3- import { profileContext , ProfileContextData , profileGetPublicAsync , UserProfile } from '../../../../lib'
3+ import { profileGetPublicAsync , UserProfile } from '../../../../lib'
44
55export interface UseGetUserProfileData {
66 isOwnProfile : boolean
@@ -9,8 +9,6 @@ export interface UseGetUserProfileData {
99}
1010
1111export function useGetUserProfile ( memberHandle ?: string ) : UseGetUserProfileData {
12- const profileData : ProfileContextData = useContext ( profileContext )
13-
1412 const [ profile , setProfile ] : [
1513 UserProfile | undefined ,
1614 Dispatch < SetStateAction < UserProfile | undefined > >
@@ -19,21 +17,14 @@ export function useGetUserProfile(memberHandle?: string): UseGetUserProfileData
1917 const [ profileReady , setProfileReady ] : [ boolean , Dispatch < SetStateAction < boolean > > ] = useState < boolean > ( false )
2018
2119 useEffect ( ( ) => {
22- if ( ! profileData ?. initialized ) {
23- return
24- }
25-
26- if ( profileData . profile ) {
27- setProfile ( profileData . profile )
28- setProfileReady ( true )
29- } else if ( memberHandle ) {
20+ if ( memberHandle ) {
3021 profileGetPublicAsync ( memberHandle )
3122 . then ( userProfile => {
3223 setProfile ( userProfile )
3324 setProfileReady ( true )
3425 } )
3526 }
36- } , [ memberHandle , profileData ?. initialized , profileData . profile , setProfileReady ] )
27+ } , [ memberHandle , setProfileReady ] )
3728
3829 return {
3930 isOwnProfile : ! ! profile ?. email ,
0 commit comments