Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(Question): Dealing with Modal not disappearing after closing Question

haitaoo3dee1c3df5bf
diff --git a/ui/src/hooks/useReportModal/index.tsx b/ui/src/hooks/useReportModal/index.tsx
index 28b85eb5..748564d9 100644
--- a/ui/src/hooks/useReportModal/index.tsx
+++ b/ui/src/hooks/useReportModal/index.tsx
@@ -47,7 +47,11 @@ const useReportModal = (callback?: () => void) => {
setShow(true);
});
};
-
+ const asyncCallback = () => {
+ setTimeout(() => {
+ callback?.();
+ });
+ };
const handleRadio = (val) => {
setInvalidState(false);
setContent({
@@ -93,8 +97,8 @@ const useReportModal = (callback?: () => void) => {
close_type: reportType.type,
close_msg: content.value,
}).then(() => {
- callback?.();
onClose();
+ asyncCallback();
});
return;
}
@@ -109,8 +113,8 @@ const useReportModal = (callback?: () => void) => {
msg: t('flag_success', { keyPrefix: 'toast' }),
variant: 'warning',
});
- callback?.();
onClose();
+ asyncCallback();
});
}
@@ -121,8 +125,8 @@ const useReportModal = (callback?: () => void) => {
flagged_type: reportType.type,
id: params.id,
}).then(() => {
- callback?.();
onClose();
+ asyncCallback();
});
}
};