refactor(useAgent): simplify mutate call in agent update

The previous implementation unnecessarily spread the previous state when only the result is needed. This simplifies the mutation logic while maintaining the same behavior.
This commit is contained in:
icarus 2025-09-19 15:24:33 +08:00
parent 8ead4e9c0f
commit b5ef8a93ca

View File

@ -24,10 +24,7 @@ export const useAgent = (id: string | null) => {
try {
// may change to optimistic update
const result = await client.updateAgent(form)
mutate((prev) => ({
...prev,
...result
}))
mutate(result)
window.toast.success(t('common.update_success'))
} catch (error) {
window.toast.error(formatErrorMessageWithPrefix(error, t('agent.update.error.failed')))