Better mutation errors and fix workspace creation

This commit is contained in:
Gregory Schier
2025-01-15 07:40:35 -08:00
parent 0e21d901cd
commit 3614c2acd5
8 changed files with 31 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ import { createFastMutation } from '../hooks/useFastMutation';
import { showSimpleAlert } from '../lib/alert';
import { router } from '../lib/router';
export const openWorkspaceFromSyncDir = createFastMutation({
export const openWorkspaceFromSyncDir = createFastMutation<void>({
mutationKey: [],
mutationFn: async () => {
const dir = await open({

View File

@@ -5,15 +5,16 @@ import { getRecentRequests } from '../hooks/useRecentRequests';
import { router } from '../lib/router';
import { invokeCmd } from '../lib/tauri';
export const switchWorkspace = createFastMutation({
mutationKey: ['open_workspace'],
mutationFn: async ({
workspaceId,
inNewWindow,
}: {
export const switchWorkspace = createFastMutation<
void,
unknown,
{
workspaceId: string;
inNewWindow: boolean;
}) => {
}
>({
mutationKey: ['open_workspace'],
mutationFn: async ({ workspaceId, inNewWindow }) => {
const environmentId = (await getRecentEnvironments(workspaceId))[0] ?? undefined;
const requestId = (await getRecentRequests(workspaceId))[0] ?? undefined;
const cookieJarId = (await getRecentCookieJars(workspaceId))[0] ?? undefined;