Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Move state cleanup to mutation callbacks

Edward Cui88b2e9150a1e
diff --git a/client/src/components/SiteSettings/ImportManager.tsx b/client/src/components/SiteSettings/ImportManager.tsx
index 160b7936c..ef551ee46 100644
--- a/client/src/components/SiteSettings/ImportManager.tsx
+++ b/client/src/components/SiteSettings/ImportManager.tsx
@@ -169,9 +169,16 @@ export function ImportManager({ siteId, disabled }: ImportManagerProps) {
const handleDeleteConfirm = () => {
if (deleteImportId) {
- deleteMutation.mutate(deleteImportId);
- setDeleteImportId(null);
- setShowDeleteDialog(false);
+ deleteMutation.mutate(deleteImportId, {
+ onSuccess: () => {
+ setDeleteImportId(null);
+ setShowDeleteDialog(false);
+ },
+ onError: () => {
+ setDeleteImportId(null);
+ setShowDeleteDialog(false);
+ },
+ });
}
};