From 3c80462da46ff61ca65169ce53b9e8dc289f5c40 Mon Sep 17 00:00:00 2001 From: cyfung1031 <44498510+cyfung1031@users.noreply.github.com> Date: Sun, 10 May 2026 18:00:37 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20closeWindow=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/install/App.tsx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pages/install/App.tsx b/src/pages/install/App.tsx index e2f22acae..d84d58e8c 100644 --- a/src/pages/install/App.tsx +++ b/src/pages/install/App.tsx @@ -49,6 +49,7 @@ interface PermissionItem { type Permission = PermissionItem[]; +let closingWindow = false; const closeWindow = (doBackwards: boolean) => { if (doBackwards) { history.go(-1); @@ -498,9 +499,12 @@ function App() { } if (shouldClose) { - setTimeout(() => { - closeWindow(doBackwards); - }, 500); + if (!closingWindow) { + closingWindow = true; + setTimeout(() => { + closeWindow(doBackwards); + }, 500); + } } } catch (e) { const errorMessage = scriptInfo?.userSubscribe ? t("subscribe_failed") : t("install_failed"); @@ -508,12 +512,17 @@ function App() { } }; - const handleClose = (options?: { noMoreUpdates: boolean }) => { + const handleClose = async (options?: { noMoreUpdates: boolean }) => { const { noMoreUpdates = false } = options || {}; if (noMoreUpdates && scriptInfo && !scriptInfo.userSubscribe) { - scriptClient.setCheckUpdateUrl(scriptInfo.uuid, false); + await scriptClient.setCheckUpdateUrl(scriptInfo.uuid, false); + } + if (!closingWindow) { + closingWindow = true; + setTimeout(() => { + closeWindow(doBackwards); + }, 50); } - closeWindow(doBackwards); }; const { From 7eccfa95692176e06f085bdd5d17b852c7335fb4 Mon Sep 17 00:00:00 2001 From: cyfung1031 <44498510+cyfung1031@users.noreply.github.com> Date: Sun, 10 May 2026 18:01:55 +0900 Subject: [PATCH 2/3] Update App.tsx --- src/pages/install/App.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/install/App.tsx b/src/pages/install/App.tsx index d84d58e8c..6e4093d75 100644 --- a/src/pages/install/App.tsx +++ b/src/pages/install/App.tsx @@ -315,7 +315,9 @@ function App() { }; useEffect(() => { + closingWindow = false; // reset !loaded && initAsync(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchParams, loaded]); const [watchFile, setWatchFile] = useState(false); From 3897561306b21ba810746a7eac14e396047b85be Mon Sep 17 00:00:00 2001 From: cyfung1031 <44498510+cyfung1031@users.noreply.github.com> Date: Sun, 10 May 2026 18:04:48 +0900 Subject: [PATCH 3/3] Update App.tsx --- src/pages/install/App.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/install/App.tsx b/src/pages/install/App.tsx index 6e4093d75..f8004293b 100644 --- a/src/pages/install/App.tsx +++ b/src/pages/install/App.tsx @@ -458,6 +458,7 @@ function App() { }; const handleInstall = async (options: { closeAfterInstall?: boolean; noMoreUpdates?: boolean } = {}) => { + if (closingWindow) return; if (!upsertScript) { Message.error(t("script_info_load_failed")!); return; @@ -515,6 +516,7 @@ function App() { }; const handleClose = async (options?: { noMoreUpdates: boolean }) => { + if (closingWindow) return; const { noMoreUpdates = false } = options || {}; if (noMoreUpdates && scriptInfo && !scriptInfo.userSubscribe) { await scriptClient.setCheckUpdateUrl(scriptInfo.uuid, false);