From 2b76c326eeb2a055a77ec37c17c4a1e28dbe3caf Mon Sep 17 00:00:00 2001 From: icarus Date: Thu, 18 Sep 2025 18:08:45 +0800 Subject: [PATCH] refactor(agents): replace useMutation with simpler implementation in useRemoveAgent --- .../src/hooks/agents/useRemoveAgent.ts | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/renderer/src/hooks/agents/useRemoveAgent.ts b/src/renderer/src/hooks/agents/useRemoveAgent.ts index 55eaf0092b..6a9f753783 100644 --- a/src/renderer/src/hooks/agents/useRemoveAgent.ts +++ b/src/renderer/src/hooks/agents/useRemoveAgent.ts @@ -1,16 +1,12 @@ -import { AgentEntity } from '@renderer/types' -import { useMutation, useQueryClient } from '@tanstack/react-query' +// import { useSWRConfig } from 'swr' export const useRemoveAgent = () => { - const qc = useQueryClient() - - // TODO: use api - return useMutation({ - mutationFn: async (id: string) => { - return id + // const { mutate } = useSWRConfig() + return { + removeAgent: () => { + // not implemented + window.toast.info('Not implemented') }, - onSuccess: (deletedId: string) => { - qc.setQueryData(['agents'], (old) => old?.filter((t) => t.id !== deletedId)) - } - }) + status: {} + } }