mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
exp(orbit): teardown edge cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,11 +59,11 @@ export default function OrbitSessionBar() {
|
|||||||
return () => window.clearInterval(id);
|
return () => window.clearInterval(id);
|
||||||
}, [state, phase]);
|
}, [state, phase]);
|
||||||
|
|
||||||
// Bar is visible while active, ended (pre-ack), or explicitly kicked.
|
// Bar is visible while active, ended (pre-ack), or explicitly kicked / soft-removed.
|
||||||
const shouldShowBar = !!state && (
|
const shouldShowBar = !!state && (
|
||||||
phase === 'active'
|
phase === 'active'
|
||||||
|| phase === 'ended'
|
|| phase === 'ended'
|
||||||
|| (phase === 'error' && errorMessage === 'kicked')
|
|| (phase === 'error' && (errorMessage === 'kicked' || errorMessage === 'removed'))
|
||||||
);
|
);
|
||||||
if (!shouldShowBar || !state) return (
|
if (!shouldShowBar || !state) return (
|
||||||
<OrbitExitModal />
|
<OrbitExitModal />
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { getSong } from '../api/subsonic';
|
|||||||
import {
|
import {
|
||||||
readOrbitState,
|
readOrbitState,
|
||||||
writeOrbitHeartbeat,
|
writeOrbitHeartbeat,
|
||||||
leaveOrbitSession,
|
|
||||||
} from '../utils/orbit';
|
} from '../utils/orbit';
|
||||||
import { orbitOutboxPlaylistName, estimateLivePosition, type OrbitState } from '../api/orbit';
|
import { orbitOutboxPlaylistName, estimateLivePosition, type OrbitState } from '../api/orbit';
|
||||||
|
|
||||||
@@ -93,9 +92,13 @@ export function useOrbitGuest(): void {
|
|||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// Session playlist is gone — host must have nuked it. Tear down
|
// Session playlist is gone — almost always means the host ended the
|
||||||
// silently; the exit-modal is the "ended" path below, not this.
|
// session and the `ended:true` write was missed because we polled
|
||||||
void leaveOrbitSession();
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user