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 -2
View File
@@ -290,9 +290,9 @@ function speak(text: string, profileName: string, cancelPrevious: boolean = fals
if (!voicesLoaded) loadVoices()
// Chrome bug: speechSynthesis can get stuck. Nudge it.
if (speechSynthesis.paused) speechSynthesis.resume()
// Only flush if queue is getting deep — allows voices to overlap naturally
// Flush if queue is getting deep — max 2 queued to prevent buildup
if (cancelPrevious || (speechSynthesis.pending && speechSynthesis.speaking)) {
if (_speechQueueDepth > 3) {
if (_speechQueueDepth > 2) {
speechSynthesis.cancel()
_speechQueueDepth = 0
}