mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
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:
1 parent
d1544bab42
commit
1a1f365cf1
1 file changed
+5
@@ -202,6 +202,11 @@ export const usePlayerStore = defineStore('player', {
|
|||||||
this.bots = this.bots.filter((b) => b.id !== botId);
|
this.bots = this.bots.filter((b) => b.id !== botId);
|
||||||
delete this.queues[botId];
|
delete this.queues[botId];
|
||||||
delete this.timings[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[]) {
|
setQueue(botId: string, queue: Song[]) {
|
||||||
|
|||||||
Reference in new issue
Block a user