Skip to content

Commit b6ee59a

Browse files
committed
Move can suto start to be on WorkspaceReadyPage
1 parent 168024d commit b6ee59a

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

site/src/pages/WorkspacePage/WorkspacePage.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { ErrorAlert } from "components/Alert/ErrorAlert";
99
import { useOrganizationId } from "hooks";
1010
import { isAxiosError } from "axios";
1111
import { Margins } from "components/Margins/Margins";
12-
import { workspaceResolveAutostart } from "api/queries/workspaceQuota";
1312
import { useInfiniteQuery, useQuery } from "react-query";
1413
import { infiniteWorkspaceBuilds } from "api/queries/workspaceBuilds";
1514
import { templateByName } from "api/queries/templates";
@@ -65,11 +64,6 @@ export const WorkspacePage: FC = () => {
6564
const pageError =
6665
workspaceQuery.error ?? templateQuery.error ?? permissionsQuery.error;
6766
const isLoading = !workspace || !template || !permissions;
68-
const canAutostartResponse = useQuery(
69-
workspaceResolveAutostart(workspace?.id ?? ""),
70-
);
71-
72-
const canAutostart = !canAutostartResponse.data?.parameter_mismatch ?? false;
7367

7468
if (pageError) {
7569
return (
@@ -102,7 +96,6 @@ export const WorkspacePage: FC = () => {
10296
await buildsQuery.fetchNextPage();
10397
}}
10498
hasMoreBuilds={Boolean(buildsQuery.hasNextPage)}
105-
canAutostart={canAutostart}
10699
/>
107100
</RequirePermission>
108101
);

site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { getErrorMessage } from "api/errors";
3838
import { displaySuccess, displayError } from "components/GlobalSnackbar/utils";
3939
import { deploymentConfig } from "api/queries/deployment";
4040
import { WorkspacePermissions } from "./permissions";
41+
import { workspaceResolveAutostart } from "api/queries/workspaceQuota";
4142

4243
interface WorkspaceReadyPageProps {
4344
template: TypesGen.Template;
@@ -53,7 +54,6 @@ interface WorkspaceReadyPageProps {
5354
onLoadMoreBuilds: () => void;
5455
isLoadingMoreBuilds: boolean;
5556
hasMoreBuilds: boolean;
56-
canAutostart: boolean;
5757
}
5858

5959
export const WorkspaceReadyPage = ({
@@ -67,7 +67,6 @@ export const WorkspaceReadyPage = ({
6767
onLoadMoreBuilds,
6868
isLoadingMoreBuilds,
6969
hasMoreBuilds,
70-
canAutostart,
7170
}: WorkspaceReadyPageProps): JSX.Element => {
7271
const { buildInfo } = useDashboard();
7372
const featureVisibility = useFeatureVisibility();
@@ -146,6 +145,11 @@ export const WorkspaceReadyPage = ({
146145
onError: onDeadlineChangeFails,
147146
});
148147

148+
const canAutostartResponse = useQuery(
149+
workspaceResolveAutostart(workspace.id),
150+
);
151+
const canAutostart = !canAutostartResponse.data?.parameter_mismatch ?? false;
152+
149153
return (
150154
<>
151155
<Helmet>

0 commit comments

Comments
 (0)