fix(scope): clear scope when the scoped bot is removed [#82 review]

removeBotStatus (botRemoved WS frame or admin deleting the scoped bot) left
scopedBotId dangling: isScoped stayed true, displayedBots went empty, and activeBot
silently fell back to bots[0], locking the UI onto a phantom bot. Clear the scope
when the scoped bot disappears.
This commit is contained in:
saopig1 committed 2026-06-16 14:43:18 +08:00
1 parent d1544bab42
commit 1a1f365cf1
1 file changed
+5
+5
View File
@@ -202,6 +202,11 @@ export const usePlayerStore = defineStore('player', {
this.bots = this.bots.filter((b) => b.id !== botId);
delete this.queues[botId];
delete this.timings[botId];
// If the bot we were locked to is gone, drop the scope so the UI does not
// stay 'locked' onto a phantom (activeBot would silently fall back to bots[0]).
if (this.scopedBotId === botId) {
this.clearScope();
}
},
setQueue(botId: string, queue: Song[]) {