From 60c254c4416e4599d06d28c28d6cb9835e9f3f57 Mon Sep 17 00:00:00 2001 From: Miha Lunar Date: Sun, 7 Jan 2024 19:40:25 +0100 Subject: [PATCH] Fix endless stale scene loading while contents are loaded --- ui/src/api.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ui/src/api.js b/ui/src/api.js index 82f3903..2bf2dfc 100644 --- a/ui/src/api.js +++ b/ui/src/api.js @@ -209,7 +209,6 @@ export function useScene({ const scene = computed(() => { const list = scenes?.value; if (!list || list.length == 0) return null; - if (list[0].stale) return null; return list[0]; }); @@ -225,9 +224,7 @@ export function useScene({ if (!scenes || scenes.length === 0) { console.log("scene not found, creating..."); await recreateScene(); - } else if (scenes.length >= 1 && scenes[0].stale) { - console.log("scene stale, recreating..."); - await recreateScene(); + return; } }) @@ -250,9 +247,15 @@ export function useScene({ } loadSpeed.value = next - prev; run(); - } else { - reset(); - loadSpeed.value = 0; + return; + } + reset(); + loadSpeed.value = 0; + + if (newValue.stale && !newValue.loading && !oldValue?.loading) { + console.log("scene stale, recreating..."); + await recreateScene(); + return; } })