@@ -23,27 +23,29 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
2323 ( org ) => org . $id === project . teamId
2424 ) ;
2525
26- const includedInBasePlans = plansInfo . has ( organization . billingPlan ) ;
26+ // organization can be null if not in the filtered list!
27+ const includedInBasePlans = plansInfo . has ( organization ?. billingPlan ) ;
2728
28- const [ org , regionalConsoleVariables , rolesResult , organizationPlan ] = await Promise . all ( [
29+ const [ org , regionalConsoleVariables , rolesResult ] = await Promise . all ( [
2930 ! organization
3031 ? ( sdk . forConsole . teams . get ( { teamId : project . teamId } ) as Promise < Organization > )
3132 : organization ,
3233 sdk . forConsoleIn ( project . region ) . console . variables ( ) ,
3334 isCloud ? sdk . forConsole . billing . getRoles ( project . teamId ) : null ,
3435
35- // fetch if not available in `plansInfo`
36- includedInBasePlans
37- ? plansInfo . get ( organization . billingPlan )
38- : isCloud
39- ? sdk . forConsole . billing . getOrganizationPlan ( organization . $id )
40- : null ,
41-
4236 loadAvailableRegions ( project . teamId )
4337 ] ) ;
4438
4539 if ( ! organization ) organization = org ;
4640
41+ // fetch if not available in `plansInfo`.
42+ // out of promise.all because we filter orgs based on platform now!
43+ const organizationPlan = includedInBasePlans
44+ ? plansInfo . get ( organization ?. billingPlan )
45+ : isCloud
46+ ? await sdk . forConsole . billing . getOrganizationPlan ( organization ?. $id )
47+ : null ;
48+
4749 const roles = rolesResult ?. roles ?? defaultRoles ;
4850 const scopes = rolesResult ?. scopes ?? defaultScopes ;
4951
0 commit comments