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,21 +1,12 @@
import { useFastMutation } from './useFastMutation';
import type { GrpcConnection } from '@yaakapp-internal/models';
import {useSetAtom} from "jotai";
import { invokeCmd } from '../lib/tauri';
import {grpcConnectionsAtom} from "./useGrpcConnections";
import {removeModelById} from "./useSyncModelStores";
import { useFastMutation } from './useFastMutation';
export function useDeleteGrpcConnection(id: string | null) {
const setGrpcConnections = useSetAtom(grpcConnectionsAtom);
return useFastMutation<GrpcConnection>({
mutationKey: ['delete_grpc_connection', id],
mutationFn: async () => {
return await invokeCmd('cmd_delete_grpc_connection', { id: id });
},
onSuccess: (connection) => {
if (connection == null) return;
setGrpcConnections(removeModelById(connection));
}
});
}