From da5b12aa2d54e301c723378a41960eda573343a7 Mon Sep 17 00:00:00 2001 From: cenfun Date: Wed, 5 Jun 2024 21:13:46 +0800 Subject: [PATCH] fix loading --- js/custom-nodes-manager.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/custom-nodes-manager.js b/js/custom-nodes-manager.js index f3fc0007..224f9ab1 100644 --- a/js/custom-nodes-manager.js +++ b/js/custom-nodes-manager.js @@ -430,7 +430,7 @@ export class CustomNodesManager { const installGroups = { "Disabled": ["enable", "uninstall"], "Update": ["update", "disable", "uninstall"], - "Fail": ["try-fix"], + "Fail": ["try-fix", "uninstall"], "True": ["try-update", "disable", "uninstall"], "False": ["install"], 'None': ["try-install"] @@ -982,6 +982,14 @@ export class CustomNodesManager { const res = await api.fetchApi(route, options).catch(e => { err = e; }); + + if (!res) { + return { + status: 400, + error: new Error("Unknown Error") + } + } + const { status, statusText } = res; if (err) { return { @@ -993,7 +1001,7 @@ export class CustomNodesManager { if (status !== 200) { return { status, - error: new Error(statusText) + error: new Error(statusText || "Unknown Error") } } @@ -1340,9 +1348,13 @@ export class CustomNodesManager { $elem.setAttribute("disabled", "disabled"); } else { $elem.removeAttribute("disabled"); - $elem.classList.remove("cn-btn-loading"); } }); + + Array.from(this.element.querySelectorAll(".cn-btn-loading")).forEach($elem => { + $elem.classList.remove("cn-btn-loading"); + }); + } showRestart() {