File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import useControlPlane from '@/hooks/use-control-plane' ;
12import { cloudApi } from '@/lib/api/api' ;
23import {
34 APICloudMetadata ,
@@ -66,11 +67,14 @@ type UseCloudReturn =
6667
6768export default function useCloud ( tenantId ?: string ) : UseCloudReturn {
6869 const cloudMetaQuery = useQuery ( getCloudMetadataQuery ) ;
70+ const { isControlPlaneEnabled, controlPlaneMeta } = useControlPlane ( ) ;
6971
7072 const featureFlagsQuery = useQuery ( {
7173 queryKey : [ 'feature-flags:list' , tenantId ] ,
7274 retry : false ,
73- enabled : cloudMetaQuery . data ?. isCloudEnabled && ! ! tenantId ,
75+ enabled :
76+ ( isControlPlaneEnabled || cloudMetaQuery . data ?. isCloudEnabled ) &&
77+ ! ! tenantId ,
7478 queryFn : async ( ) => {
7579 try {
7680 // This shouldn't be possible because of the `enabled` above, and yet, Josh found it happening at runtime
@@ -86,6 +90,22 @@ export default function useCloud(tenantId?: string): UseCloudReturn {
8690 staleTime : 1000 * 60 ,
8791 } ) ;
8892
93+ if ( isControlPlaneEnabled ) {
94+ return {
95+ cloud : {
96+ canBill : true ,
97+ canLinkGithub : true ,
98+ metricsEnabled : true ,
99+ requireBillingForManagedCompute : true ,
100+ inactivityLogoutMs : controlPlaneMeta ?. inactivityLogoutMs ,
101+ } ,
102+ isCloudEnabled : true ,
103+ isCloudLoaded : true ,
104+ isCloudLoading : false ,
105+ featureFlags : featureFlagsQuery . data ?. data || null ,
106+ } ;
107+ }
108+
89109 if ( cloudMetaQuery . data && cloudMetaQuery . data . isCloudEnabled ) {
90110 return {
91111 cloud : cloudMetaQuery . data ,
You can’t perform that action at this time.
0 commit comments