Fix workspace creation, reveal sync dir, and don't update timestamps on sync/import

This commit is contained in:
Gregory Schier
2025-01-09 07:50:23 -08:00
parent 0a7257c55a
commit f694456ddc
33 changed files with 312 additions and 219 deletions

View File

@@ -0,0 +1,19 @@
import type { Workspace } from '@yaakapp-internal/models';
import { createFastMutation } from '../hooks/useFastMutation';
import { trackEvent } from '../lib/analytics';
import { invokeCmd } from '../lib/tauri';
export const upsertWorkspace = createFastMutation<
Workspace,
void,
Workspace | Partial<Omit<Workspace, 'id'>>
>({
mutationKey: ['upsert_workspace'],
mutationFn: (workspace) => invokeCmd<Workspace>('cmd_update_workspace', { workspace }),
onSuccess: async (workspace) => {
const isNew = workspace.createdAt == workspace.updatedAt;
if (isNew) trackEvent('workspace', 'create');
else trackEvent('workspace', 'update');
},
});