From 9b311aa68af84d7c8b3532518a7210e242bcc8ad Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 19 Mar 2026 11:12:27 +0200 Subject: [PATCH] add onSuccess/onError to delete post mutation --- src/state/queries/post.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/state/queries/post.ts b/src/state/queries/post.ts index 4024001a90..7fa85d586a 100644 --- a/src/state/queries/post.ts +++ b/src/state/queries/post.ts @@ -335,7 +335,10 @@ function usePostUnrepostMutation( }) } -export function usePostDeleteMutation() { +export function usePostDeleteMutation({ + onSuccess, + onError, +}: {onSuccess?: () => void; onError?: (error: Error) => void} = {}) { const queryClient = useQueryClient() const agent = useAgent() return useMutation({ @@ -344,7 +347,9 @@ export function usePostDeleteMutation() { }, onSuccess(_, variables) { updatePostShadow(queryClient, variables.uri, {isDeleted: true}) + onSuccess?.() }, + onError, }) }