From f5c6fa842aefe0b4d796a9d255bbf46cc97e7ffd Mon Sep 17 00:00:00 2001 From: GyDi Date: Tue, 17 May 2022 00:51:37 +0800 Subject: [PATCH] fix: adjust notice --- src/components/base/base-notice.tsx | 4 ++-- src/components/profile/enhanced.tsx | 2 +- src/pages/profiles.tsx | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/base/base-notice.tsx b/src/components/base/base-notice.tsx index 33d7aff..d7909f4 100644 --- a/src/components/base/base-notice.tsx +++ b/src/components/base/base-notice.tsx @@ -11,7 +11,7 @@ interface InnerProps { } const NoticeInner = (props: InnerProps) => { - const { type, message, duration = 2000, onClose } = props; + const { type, message, duration = 1500, onClose } = props; const [visible, setVisible] = useState(true); const onBtnClose = () => { @@ -79,7 +79,7 @@ const Notice: NoticeInstance = (props) => { const onUnmount = () => { const result = ReactDOM.unmountComponentAtNode(container); - if (result && parent) parent.removeChild(container); + if (result && parent) setTimeout(() => parent.removeChild(container), 300); }; ReactDOM.render(, container); diff --git a/src/components/profile/enhanced.tsx b/src/components/profile/enhanced.tsx index 2a5ab6a..a574361 100644 --- a/src/components/profile/enhanced.tsx +++ b/src/components/profile/enhanced.tsx @@ -49,7 +49,7 @@ const EnhancedMode = (props: Props) => { const onEnhance = useLockFn(async () => { try { await enhanceProfiles(); - Notice.success("Refresh clash config", 2000); + Notice.success("Refresh clash config", 1000); } catch (err: any) { Notice.error(err.message || err.toString()); } diff --git a/src/pages/profiles.tsx b/src/pages/profiles.tsx index d135362..8263898 100644 --- a/src/pages/profiles.tsx +++ b/src/pages/profiles.tsx @@ -122,6 +122,7 @@ const ProfilePage = () => { try { await selectProfile(uid); mutate("getProfiles", { ...profiles, current: uid }, true); + if (force) Notice.success("Refresh clash config", 1000); } catch (err: any) { Notice.error(err?.message || err.toString()); }