File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -51,17 +51,18 @@ const App: FunctionComponent = () => {
51
51
if ( ! user ) {
52
52
return < Login /> ;
53
53
}
54
- // TODO(gpl) "isLoading" is "true" even if there are errors in this "useCurrentOrg" call.
55
- // Why don't understand as to why .isLoading is not resolved at some point, though. Maybe we're missing proper error handling for useOrganizations
56
- // if (currentOrgQuery.isLoading) {
57
- // return <AppLoading />;
58
- // }
54
+
55
+ // At this point we want to make sure that we never render AppRoutes prematurely, e.g. without finishing loading the orgs
56
+ // This would cause us to re-render the whole App again soon after, creating havoc with all our "onMount" hooks.
57
+ if ( currentOrgQuery . isLoading ) {
58
+ return < AppLoading /> ;
59
+ }
59
60
60
61
// If we made it here, we have a logged in user w/ their teams. Yay.
61
62
return (
62
63
< Suspense fallback = { < AppLoading /> } >
63
- { /* Use org id as key to force re-render on org change */ }
64
- < AppRoutes key = { currentOrgQuery . data ?. id ?? "no-org" } />
64
+ { /* Use org id, or user id (for personal account) as key to force re-render on org change */ }
65
+ < AppRoutes key = { currentOrgQuery ? .data ?. id ?? user . id } />
65
66
</ Suspense >
66
67
) ;
67
68
} ;
You can’t perform that action at this time.
0 commit comments