From 04aad417fcc7f4d6ab577bd2d763af16de692a4b Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 11 Jul 2024 20:34:51 -0400 Subject: [PATCH] Prevent spinner when failed to mount (#112) --- src/App.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index a8eb5f3b2..22f0fd9a3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -33,16 +33,25 @@ const updateNodeSearchSetting = (e: LiteGraphNodeSearchSettingEvent) => { nodeSearchEnabled.value = !e.detail; }; -onMounted(async () => { +const init = async () => { const nodeDefs = Object.values(await api.getNodeDefs()); nodeSearchService.value = new NodeSearchService(nodeDefs); - isLoading.value = false; document.addEventListener("comfy:setting:color-palette-loaded", updateTheme); document.addEventListener( "comfy:setting:litegraph-node-search", updateNodeSearchSetting ); +}; + +onMounted(async () => { + try { + await init(); + } catch (e) { + console.error("Failed to init Vue app", e); + } finally { + isLoading.value = false; + } }); onUnmounted(() => {