exp(orbit): teardown edge cases

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Psychotoxical
2026-04-23 17:39:33 +02:00
parent c7af6a6e15
commit dff2c4a121
2 changed files with 9 additions and 6 deletions
+7 -4
View File
@@ -6,7 +6,6 @@ import { getSong } from '../api/subsonic';
import {
readOrbitState,
writeOrbitHeartbeat,
leaveOrbitSession,
} from '../utils/orbit';
import { orbitOutboxPlaylistName, estimateLivePosition, type OrbitState } from '../api/orbit';
@@ -93,9 +92,13 @@ export function useOrbitGuest(): void {
if (cancelled) return;
if (!state) {
// Session playlist is gone — host must have nuked it. Tear down
// silently; the exit-modal is the "ended" path below, not this.
void leaveOrbitSession();
// Session playlist is gone — almost always means the host ended the
// session and the `ended:true` write was missed because we polled
// after the subsequent playlist delete. Surface the same modal the
// explicit `state.ended` branch does; the store still holds the last
// known state so the modal can render the host + session name copy.
// Outbox cleanup runs from the modal's OK handler via leaveOrbitSession.
useOrbitStore.getState().setPhase('ended');
return;
}