mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-22 00:37:05 +08:00
fix(component): useConfirmModal can't be closed automatically when 'onConfirm' is non-async (#6439)
This commit is contained in:
@@ -104,8 +104,8 @@ export const ConfirmModalProvider = ({ children }: PropsWithChildren) => {
|
||||
|
||||
const onConfirm = () => {
|
||||
setLoading(true);
|
||||
_onConfirm?.()
|
||||
?.then(() => onSuccess?.())
|
||||
return Promise.resolve(_onConfirm?.())
|
||||
.then(() => onSuccess?.())
|
||||
.catch(console.error)
|
||||
.finally(() => autoClose && closeConfirmModal());
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user