From 1bccb7548feda4c4b9944cfcc64675730f70fd59 Mon Sep 17 00:00:00 2001 From: LucaP Date: Sun, 11 Oct 2026 01:22:52 +0300 Subject: [PATCH] fix: stop reconciling a scene controller disposed mid-await --- src/composables/useSceneController.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/composables/useSceneController.ts b/src/composables/useSceneController.ts index b5a1fcc..65c6687 100644 --- a/src/composables/useSceneController.ts +++ b/src/composables/useSceneController.ts @@ -90,10 +90,16 @@ export function useSceneController(sources: SceneControllerSources): SceneContro } if (controller !== null) { - controller.update(sources.journey.value); - await controller.setQuality(sources.quality.value); - if (controller.snapshot().state.kind === 'paused') { - await controller.resume(); + // The controller can be disposed (context loss, policy change, pagehide) + // while setQuality or resume is pending; only touch the one we started + // with, and stop if it is no longer current. + const active = controller; + active.update(sources.journey.value); + await active.setQuality(sources.quality.value); + if (controller !== active) return; + if (active.snapshot().state.kind === 'paused') { + await active.resume(); + if (controller !== active) return; } publish(); return;