@@ -22,12 +22,20 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
22
22
( org ) => org . $id === project . teamId
23
23
) ;
24
24
25
- const [ org , regionalConsoleVariables , rolesResult ] = await Promise . all ( [
25
+ const includedInBasePlans = plansInfo . has ( organization . billingPlan ) ;
26
+
27
+ const [ org , regionalConsoleVariables , rolesResult , organizationPlan ] = await Promise . all ( [
26
28
! organization
27
29
? ( sdk . forConsole . teams . get ( project . teamId ) as Promise < Organization > )
28
30
: organization ,
29
31
sdk . forConsoleIn ( project . region ) . console . variables ( ) ,
30
32
isCloud ? sdk . forConsole . billing . getRoles ( project . teamId ) : null ,
33
+
34
+ // fetch if not available in `plansInfo`
35
+ includedInBasePlans
36
+ ? plansInfo . get ( organization . billingPlan )
37
+ : sdk . forConsole . billing . getOrganizationPlan ( organization . $id ) ,
38
+
31
39
loadAvailableRegions ( project . teamId )
32
40
] ) ;
33
41
@@ -49,13 +57,18 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
49
57
loadFailedInvoices ( project . teamId ) ;
50
58
}
51
59
60
+ if ( ! includedInBasePlans ) {
61
+ // save the custom plan to `plansInfo` cache.
62
+ plansInfo . set ( organization . billingPlan , organizationPlan ) ;
63
+ }
64
+
52
65
return {
53
66
project,
54
67
organization,
55
68
regionalConsoleVariables,
56
69
roles,
57
70
scopes,
58
- currentPlan : plansInfo . get ( organization . billingPlan )
71
+ currentPlan : organizationPlan
59
72
} ;
60
73
} ;
61
74
0 commit comments