human fight sequence fix

This commit is contained in:
Dorian
2026-03-11 10:34:08 +00:00
parent 29a0a48eb1
commit ea72c097c4
5 changed files with 80 additions and 37 deletions
+2 -1
View File
@@ -65,6 +65,7 @@ export function useFightPolling(fightId: Ref<string>) {
function startPolling(callbacks?: {
onFinished?: () => void
onTimeout?: () => void
keepLive?: boolean // Don't set isLive=false (human fights manage lifecycle via SSE)
}) {
pollCount = 0
pollHandle = setInterval(async () => {
@@ -72,7 +73,7 @@ export function useFightPolling(fightId: Ref<string>) {
const s = await loadFight()
if (s === 'finished') {
if (!eventSource) {
isLive.value = false
if (!callbacks?.keepLive) isLive.value = false
disconnectSSE()
stopPolling()
callbacks?.onFinished?.()