Skip to content

feat: add warning message when trying to delete active template #10142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 10, 2023
Prev Previous commit
Next Next commit
fix: update workspaces query logic
  • Loading branch information
Parkreiner committed Oct 9, 2023
commit bf2394ed22f1512b9083ffef351a204b159ec890
20 changes: 14 additions & 6 deletions site/src/api/queries/workspaces.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import * as API from "api/api";
import { type WorkspacesResponse } from "api/typesGenerated";
import { type QueryOptions } from "react-query";
import {
type WorkspacesResponse,
type WorkspacesRequest,
} from "api/typesGenerated";

export function workspacesByQueryKey(query: string) {
return ["workspaces", query] as const;
export function workspacesKey(config: WorkspacesRequest = {}) {
const { q, limit } = config;
return ["workspaces", { q, limit }] as const;
}

export function workspacesByQuery(query: string) {
export function workspaces(config: WorkspacesRequest = {}) {
// Duplicates some of the work from workspacesKey, but that felt better than
// letting invisible properties sneak into the query logic
const { q, limit } = config;

return {
queryKey: workspacesByQueryKey(query),
queryFn: () => API.getWorkspaces({ q: query }),
queryKey: workspacesKey(config),
queryFn: () => API.getWorkspaces({ q, limit }),
} as const satisfies QueryOptions<WorkspacesResponse>;
}