mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-09 18:53:38 +02:00
Fix workspace creation, reveal sync dir, and don't update timestamps on sync/import
This commit is contained in:
19
src-web/commands/upsertWorkspace.ts
Normal file
19
src-web/commands/upsertWorkspace.ts
Normal 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');
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user