mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-22 08:48:26 +02:00
Ability to open workspace from directory, WorkspaceMeta, and many sync improvements
This commit is contained in:
19
src-web/commands/upsertWorkspaceMeta.ts
Normal file
19
src-web/commands/upsertWorkspaceMeta.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { WorkspaceMeta } from '@yaakapp-internal/models';
|
||||
import { createFastMutation } from '../hooks/useFastMutation';
|
||||
import { workspaceMetaAtom } from '../hooks/useWorkspaceMeta';
|
||||
import { jotaiStore } from '../lib/jotai';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
|
||||
export const upsertWorkspaceMeta = createFastMutation<
|
||||
WorkspaceMeta,
|
||||
unknown,
|
||||
Partial<WorkspaceMeta>
|
||||
>({
|
||||
mutationKey: ['update_workspace_meta'],
|
||||
mutationFn: async (patch) => {
|
||||
const workspaceMeta = jotaiStore.get(workspaceMetaAtom);
|
||||
return invokeCmd<WorkspaceMeta>('cmd_update_workspace_meta', {
|
||||
workspaceMeta: { ...workspaceMeta, ...patch },
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user