@@ -162,7 +162,13 @@ export function App(props) {
162
162
const auth = useAuth ( ) ;
163
163
// This effect clause is needed to handle when the auth library loads the token on page refresh
164
164
useEffect ( ( ) => {
165
- if ( auth . isAuthenticated && ! auth . isLoading && ! user . isAuthenticated && ! auth . activeNavigator ) {
165
+ if (
166
+ auth &&
167
+ auth . isAuthenticated &&
168
+ ! auth . isLoading &&
169
+ ! user . isAuthenticated &&
170
+ ! auth . activeNavigator
171
+ ) {
166
172
dispatch ( logInSuccess ( auth . user ) ) ;
167
173
dispatch ( getUserStatus ( ) ) ;
168
174
auth . events . addUserLoaded ( ( u ) => dispatch ( userRefresh ( u ) ) ) ;
@@ -186,7 +192,7 @@ export function App(props) {
186
192
}
187
193
} ;
188
194
189
- const loggingIn = status . tdrOperational && configuration . configObject . clientId && auth . isLoading ;
195
+ const loggingIn = status . tdrOperational && configuration . configObject . clientId && auth ? .isLoading ;
190
196
191
197
return (
192
198
< div className = { classes . root } >
@@ -243,7 +249,7 @@ export function App(props) {
243
249
</ AppBar >
244
250
< div className = { clsx ( classes . content , { [ classes . loggingIn ] : loggingIn } ) } >
245
251
{ ! status . tdrOperational && < ServerErrorView /> }
246
- { status . tdrOperational && configuration . configObject . clientId && ! auth . isLoading && (
252
+ { status . tdrOperational && configuration . configObject . clientId && ! auth ? .isLoading && (
247
253
< Switch >
248
254
< Route path = "/redirect-from-oauth" exact component = { LoadingSpinner } />
249
255
< RoutePublic
@@ -268,7 +274,7 @@ export function App(props) {
268
274
) }
269
275
{ ! user . isInitiallyLoaded && (
270
276
< RoutePrivate
271
- isAuthenticated = { auth . isAuthenticated && ! auth . isLoading && ! user . isTest }
277
+ isAuthenticated = { auth ? .isAuthenticated && ! auth ? .isLoading && ! user . isTest }
272
278
path = "/"
273
279
component = { LoadingSpinner }
274
280
/>
0 commit comments