plugin:yaak-models|upsert PoC

This commit is contained in:
Gregory Schier
2025-03-26 09:54:42 -07:00
parent b7f62b78b1
commit 17657a4d04
31 changed files with 255 additions and 408 deletions

View File

@@ -1,15 +1,11 @@
import type { Folder } from '@yaakapp-internal/models';
import { useSetAtom } from 'jotai';
import { InlineCode } from '../components/core/InlineCode';
import { showConfirmDelete } from '../lib/confirm';
import { invokeCmd } from '../lib/tauri';
import { useFastMutation } from './useFastMutation';
import { foldersAtom, getFolder } from './useFolders';
import { removeModelById } from './useSyncModelStores';
import { getFolder } from './useFolders';
export function useDeleteFolder(id: string | null) {
const setFolders = useSetAtom(foldersAtom);
return useFastMutation<Folder | null, string>({
mutationKey: ['delete_folder', id],
mutationFn: async () => {
@@ -26,10 +22,5 @@ export function useDeleteFolder(id: string | null) {
if (!confirmed) return null;
return invokeCmd('cmd_delete_folder', { folderId: id });
},
onSuccess: (folder) => {
if (folder == null) return;
setFolders(removeModelById(folder));
},
});
}