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; } })