File tree 2 files changed +13
-7
lines changed
2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -53,14 +53,14 @@ export default function ProjectsList() {
53
53
} , [ ] ) ;
54
54
55
55
useEffect ( ( ) => {
56
- if ( organizationInactive == null ) return ;
56
+ if ( organizationInactive == null || ! user ) return ;
57
57
if ( ! organizationInactive ) {
58
58
refetchProjectsAndPostProcess ( ) ;
59
59
refetchStatsAndPostProcess ( ) ;
60
60
} else {
61
61
createDefaultOrg ( ) ;
62
62
}
63
- } , [ organizationInactive ] ) ;
63
+ } , [ organizationInactive , user ] ) ;
64
64
65
65
function refetchProjectsAndPostProcess ( ) {
66
66
refetchProjects ( ) . then ( ( res ) => {
@@ -91,8 +91,9 @@ export default function ProjectsList() {
91
91
return ;
92
92
}
93
93
refetchCanCreateOrg ( ) . then ( ( res ) => {
94
- setCanCreateOrg ( res . data [ "canCreateLocalOrg" ] ) ;
95
- if ( ! canCreateOrg ) return ;
94
+ const canCreate = res . data [ "canCreateLocalOrg" ]
95
+ setCanCreateOrg ( canCreate ) ;
96
+ if ( ! canCreate ) return ;
96
97
const localhostOrg = "localhost" ;
97
98
createOrgMut ( { variables : { name : localhostOrg } } ) . then ( ( res ) => {
98
99
addUserToOrgMut ( { variables : { userMail : user . mail , organizationName : localhostOrg } } ) . then ( ( res ) => {
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) {
58
58
userInfo . avatarUri = getUserAvatarUri ( res . data [ "userInfo" ] ) ;
59
59
dispatch ( setUser ( userInfo ) ) ;
60
60
dispatch ( setDisplayUserRole ( res . data [ "userInfo" ] . role ) ) ;
61
+
61
62
} ) ;
62
63
refetchOrganization ( ) . then ( ( res ) => {
63
64
if ( res . data [ "userOrganization" ] ) {
@@ -71,9 +72,6 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) {
71
72
timer ( 60000 ) . subscribe ( ( ) => location . reload ( ) )
72
73
}
73
74
} ) ;
74
- refetchOrganizationUsers ( ) . then ( ( res ) => {
75
- dispatch ( setAllUsers ( res . data [ "allUsers" ] ) ) ;
76
- } ) ;
77
75
78
76
// Set cache
79
77
refetchZeroShotRecommendations ( ) . then ( ( resZeroShot ) => {
@@ -90,6 +88,13 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) {
90
88
} ) ;
91
89
} , [ ] ) ;
92
90
91
+ useEffect ( ( ) => {
92
+ if ( ! organization ) return ;
93
+ refetchOrganizationUsers ( ) . then ( ( res ) => {
94
+ dispatch ( setAllUsers ( res . data [ "allUsers" ] ) ) ;
95
+ } ) ;
96
+ } , [ organization ] ) ;
97
+
93
98
useEffect ( ( ) => {
94
99
const routeColor = RouteManager . checkRouteHighlight ( router . asPath ) ;
95
100
dispatch ( setRouteColor ( routeColor ) ) ;
You can’t perform that action at this time.
0 commit comments