Fix bulk update document front counts

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-07-15 17:17:30 +02:00
parent be6c668aa6
commit 578289f053
3 changed files with 53 additions and 29 deletions

View File

@@ -10,7 +10,7 @@ import type { MutationParameters, GraphQLTaggedNode } from "relay-runtime";
export function useMutationWithToasts<T extends MutationParameters>(
query: GraphQLTaggedNode,
baseOptions?: {
successMessage?: string;
successMessage?: string | ((response: T["response"]) => string);
errorMessage?: string;
}
) {
@@ -21,7 +21,7 @@ export function useMutationWithToasts<T extends MutationParameters>(
(
queryOptions: UseMutationConfig<T> & {
onSuccess?: () => void;
successMessage?: string;
successMessage?: string | ((response: T["response"]) => string);
errorMessage?: string;
}
) => {
@@ -42,10 +42,14 @@ export function useMutationWithToasts<T extends MutationParameters>(
reject(error);
return;
}
const successMessage = typeof options.successMessage === "function"
? options.successMessage(response)
: options.successMessage;
toast({
title: __("Success"),
description:
options.successMessage ??
successMessage ??
__("Operation completed successfully"),
variant: "success",
});