fix: memory leaks — cleanup timers on unmount, tighten speech queue, fix isOwner reactivity

- FightViewer: track deferred speechSynthesis.cancel() timer, clear on unmount
- BotProfilePage: change isOwner from ref to computed for reactive login state
- sounds.ts: tighten speech queue depth cap from 3 to 2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-07 23:52:11 +00:00
co-authored by Claude Opus 4.6
parent c98007e95c
commit b2d1a2da02
3 changed files with 10 additions and 7 deletions
+2 -4
View File
@@ -76,7 +76,6 @@ const showChoose = ref(false)
const waitingFighters = ref<QueueEntry[]>([])
let pollHandle: ReturnType<typeof setInterval> | null = null
const isOwner = ref(false)
const loadError = ref('')
const fightError = ref('')
const showCustomize = ref(false)
@@ -102,6 +101,8 @@ const ARCHETYPES = [
'broom_man',
]
const isOwner = computed(() => isLoggedIn.value && nostrBot.value?.name === botName)
const custForm = reactive({
archetype: '',
primaryColor: '#3388cc',
@@ -216,9 +217,6 @@ onMounted(async () => {
}
isLoading.value = false
// Check ownership
isOwner.value = isLoggedIn.value && nostrBot.value?.name === botName
// Poll queue for "choose your fight"
pollQueue()
pollHandle = setInterval(pollQueue, 4000)