Skip to content

Commit

Permalink
Fix endless stale scene loading (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmilyOrg authored Jan 7, 2024
2 parents fec4b8e + 60c254c commit 5532c9f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions ui/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
});

Expand All @@ -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;
}
})

Expand All @@ -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;
}
})

Expand Down

0 comments on commit 5532c9f

Please sign in to comment.