refactor(agents): replace unimplemented mutation with simple function

Replace the placeholder mutation implementation in useUpdateAgent hook with a simpler function that shows a toast notification. This removes the unnecessary query client usage for an unimplemented feature.
This commit is contained in:
icarus 2025-09-18 18:10:53 +08:00
parent 71536d6ef5
commit 21ce139df0

View File

@ -1,18 +1,7 @@
import { AgentEntity } from '@renderer/types'
import { useMutation, useQueryClient } from '@tanstack/react-query'
export const useUpdateAgent = () => {
const qc = useQueryClient()
// TODO: use api
return useMutation({
mutationFn: async (agentUpdate: Partial<AgentEntity> & { id: string }) => {
throw new Error(`useUpdateAgent mutationFn not implemented for agent ${agentUpdate.id}`)
},
onSuccess: (updated: AgentEntity) => {
qc.setQueryData<AgentEntity[]>(['todos'], (old) =>
old ? old.map((t) => (t.id === updated.id ? updated : t)) : []
)
return {
updateAgent: () => {
window.toast.info('Not implemented')
}
})
}
}