1
1
import { usePagination } from "hooks/usePagination" ;
2
2
import { Workspace } from "api/typesGenerated" ;
3
- import {
4
- useDashboard ,
5
- useIsWorkspaceActionsEnabled ,
6
- } from "components/Dashboard/DashboardProvider" ;
3
+ import { useDashboard } from "components/Dashboard/DashboardProvider" ;
7
4
import { type FC , useEffect , useState } from "react" ;
8
5
import { Helmet } from "react-helmet-async" ;
9
6
import { pageTitle } from "utils/page" ;
@@ -54,13 +51,16 @@ const WorkspacesPage: FC = () => {
54
51
query : filterProps . filter . query ,
55
52
} ) ;
56
53
57
- const experimentEnabled = useIsWorkspaceActionsEnabled ( ) ;
54
+ const { entitlements } = useDashboard ( ) ;
55
+ const schedulingEnabled =
56
+ entitlements . features [ "advanced_template_scheduling" ] . enabled ;
57
+
58
58
// If workspace actions are enabled we need to fetch the dormant
59
59
// workspaces as well. This lets us determine whether we should
60
60
// show a banner to the user indicating that some of their workspaces
61
61
// are at risk of being deleted.
62
62
useEffect ( ( ) => {
63
- if ( experimentEnabled ) {
63
+ if ( schedulingEnabled ) {
64
64
const includesDormant = filterProps . filter . query . includes ( "dormant_at" ) ;
65
65
const dormantQuery = includesDormant
66
66
? filterProps . filter . query
@@ -82,12 +82,11 @@ const WorkspacesPage: FC = () => {
82
82
// like dormant workspaces don't exist.
83
83
setDormantWorkspaces ( [ ] ) ;
84
84
}
85
- } , [ experimentEnabled , data , filterProps . filter . query ] ) ;
85
+ } , [ schedulingEnabled , data , filterProps . filter . query ] ) ;
86
86
const updateWorkspace = useWorkspaceUpdate ( queryKey ) ;
87
87
const [ checkedWorkspaces , setCheckedWorkspaces ] = useState < Workspace [ ] > ( [ ] ) ;
88
88
const [ isDeletingAll , setIsDeletingAll ] = useState ( false ) ;
89
89
const [ urlSearchParams ] = searchParamsResult ;
90
- const { entitlements } = useDashboard ( ) ;
91
90
const canCheckWorkspaces =
92
91
entitlements . features [ "workspace_batch_actions" ] . enabled ;
93
92
0 commit comments