File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 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() {
5353 } , [ ] ) ;
5454
5555 useEffect ( ( ) => {
56- if ( organizationInactive == null ) return ;
56+ if ( organizationInactive == null || ! user ) return ;
5757 if ( ! organizationInactive ) {
5858 refetchProjectsAndPostProcess ( ) ;
5959 refetchStatsAndPostProcess ( ) ;
6060 } else {
6161 createDefaultOrg ( ) ;
6262 }
63- } , [ organizationInactive ] ) ;
63+ } , [ organizationInactive , user ] ) ;
6464
6565 function refetchProjectsAndPostProcess ( ) {
6666 refetchProjects ( ) . then ( ( res ) => {
@@ -91,8 +91,9 @@ export default function ProjectsList() {
9191 return ;
9292 }
9393 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 ;
9697 const localhostOrg = "localhost" ;
9798 createOrgMut ( { variables : { name : localhostOrg } } ) . then ( ( res ) => {
9899 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) {
5858 userInfo . avatarUri = getUserAvatarUri ( res . data [ "userInfo" ] ) ;
5959 dispatch ( setUser ( userInfo ) ) ;
6060 dispatch ( setDisplayUserRole ( res . data [ "userInfo" ] . role ) ) ;
61+
6162 } ) ;
6263 refetchOrganization ( ) . then ( ( res ) => {
6364 if ( res . data [ "userOrganization" ] ) {
@@ -71,9 +72,6 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) {
7172 timer ( 60000 ) . subscribe ( ( ) => location . reload ( ) )
7273 }
7374 } ) ;
74- refetchOrganizationUsers ( ) . then ( ( res ) => {
75- dispatch ( setAllUsers ( res . data [ "allUsers" ] ) ) ;
76- } ) ;
7775
7876 // Set cache
7977 refetchZeroShotRecommendations ( ) . then ( ( resZeroShot ) => {
@@ -90,6 +88,13 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) {
9088 } ) ;
9189 } , [ ] ) ;
9290
91+ useEffect ( ( ) => {
92+ if ( ! organization ) return ;
93+ refetchOrganizationUsers ( ) . then ( ( res ) => {
94+ dispatch ( setAllUsers ( res . data [ "allUsers" ] ) ) ;
95+ } ) ;
96+ } , [ organization ] ) ;
97+
9398 useEffect ( ( ) => {
9499 const routeColor = RouteManager . checkRouteHighlight ( router . asPath ) ;
95100 dispatch ( setRouteColor ( routeColor ) ) ;
You can’t perform that action at this time.
0 commit comments