This commit is contained in:
André Michelle
2026-03-19 17:38:27 +01:00
parent 9f1a0ac495
commit 4881a5097a
@@ -396,7 +396,10 @@ export class StudioService implements ProjectEnv {
const previousScreen = this.#activeCodeEditor.map(state => state.previousScreen).unwrapOrNull()
this.#activeCodeEditor.clear()
if (this.layout.screen.getValue() === "code") {
this.layout.screen.setValue(previousScreen ?? "default")
// Defer the screen switch to avoid cascading UI updates during synchronous
// box deletion. Switching the screen triggers DevicePanel re-evaluation which
// clears mounts before remaining pointerHub onRemoved events have finished.
queueMicrotask(() => this.layout.screen.setValue(previousScreen ?? "default"))
}
}