File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,11 @@ const App: FunctionComponent = () => {
51
51
if ( ! user ) {
52
52
return < Login /> ;
53
53
}
54
- if ( currentOrgQuery . isLoading ) {
55
- return < AppLoading /> ;
56
- }
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
+ // }
57
59
58
60
// If we made it here, we have a logged in user w/ their teams. Yay.
59
61
return (
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ export function useOrganizations() {
39
39
getQueryKey ( user ) ,
40
40
async ( ) => {
41
41
console . log ( "Fetching orgs... " + JSON . stringify ( getQueryKey ( user ) ) ) ;
42
+ if ( ! user ) {
43
+ console . log ( "useOrganizations with empty user" ) ;
44
+ return [ ] ;
45
+ }
46
+
42
47
const response = await teamsService . listTeams ( { } ) ;
43
48
const result : OrganizationInfo [ ] = [ ] ;
44
49
for ( const org of response . teams ) {
@@ -64,6 +69,9 @@ export function useOrganizations() {
64
69
refreshUserBillingMode ( ) ;
65
70
queryClient . invalidateQueries ( getUserBillingModeQueryKey ( user . id ) ) ;
66
71
} ,
72
+ onError : ( err ) => {
73
+ console . error ( "useOrganizations" , err ) ;
74
+ } ,
67
75
enabled : ! ! user ,
68
76
cacheTime : 1000 * 60 * 60 * 1 , // 1 hour
69
77
staleTime : 1000 * 60 * 60 * 1 , // 1 hour
You can’t perform that action at this time.
0 commit comments