Fix deletion freeze
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -68,7 +68,7 @@ export function useMutationWithToasts<T extends MutationParameters>(
|
||||
})
|
||||
);
|
||||
},
|
||||
[mutate]
|
||||
[mutate, toast, __]
|
||||
);
|
||||
|
||||
return [mutateWithToast, isLoading] as const;
|
||||
|
||||
@@ -79,13 +79,14 @@ export function ConfirmDialog() {
|
||||
footer,
|
||||
} = dialog();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const handleConfirm = () => {
|
||||
const handleConfirm = async () => {
|
||||
setLoading(true);
|
||||
onConfirm()
|
||||
.finally(() => {
|
||||
close();
|
||||
setLoading(false);
|
||||
});
|
||||
try {
|
||||
await onConfirm();
|
||||
} finally {
|
||||
close();
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user