Skip to content

Commit 16d90cf

Browse files
PROD-3115 #comment This commit waits to initialize the nav when the profile is ready. #time 15m
1 parent 0d5c360 commit 16d90cf

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

src-ts/header/Header.tsx

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const Header: FC = () => {
6161

6262
useEffect(() => {
6363

64-
if (headerInit.current) {
64+
if (headerInit.current || !profileReady) {
6565
return
6666
}
6767

@@ -82,27 +82,20 @@ const Header: FC = () => {
8282
toolName: activeToolName,
8383
toolRoute: activeToolRoute,
8484
type: 'tool',
85+
user: profile ? {
86+
handle: profile.handle,
87+
initials: `${profile.firstName.charAt(0)}${profile.lastName.charAt(0)}`,
88+
photoURL: profile.photoURL,
89+
userId: profile.userId,
90+
} : undefined,
8591
},
8692
)
8793
}, [
8894
activeToolName,
8995
activeToolRoute,
9096
navigationHandler,
91-
])
92-
93-
useEffect(() => {
94-
95-
tcUniNav(
96-
'update',
97-
navElementId,
98-
{
99-
toolName: activeToolName,
100-
toolRoute: activeToolRoute,
101-
},
102-
)
103-
}, [
104-
activeToolName,
105-
activeToolRoute,
97+
profile,
98+
profileReady,
10699
])
107100

108101
useEffect(() => {
@@ -115,17 +108,14 @@ const Header: FC = () => {
115108
'update',
116109
navElementId,
117110
{
118-
user: profile ? {
119-
handle: profile.handle,
120-
initials: `${profile.firstName.charAt(0)}${profile.lastName.charAt(0)}`,
121-
photoURL: profile.photoURL,
122-
userId: profile.userId,
123-
} : undefined,
111+
toolName: activeToolName,
112+
toolRoute: activeToolRoute,
124113
},
125114
)
126115
}, [
116+
activeToolName,
117+
activeToolRoute,
127118
profileReady,
128-
profile,
129119
])
130120

131121
return (

0 commit comments

Comments
 (0)