feat(scope): lock Navbar selector to scoped bot + apply scope on load

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.8 committed 2026-05-30 15:17:01 +08:00
1 parent 88ac7d2a68
commit 463a8e2f8a
2 files changed
+89 -5

No files matched your search

+7 -2
View File
@@ -140,12 +140,17 @@ function cycleMobileMode() {
playerStore.setMode(nextMode);
}
onMounted(() => {
onMounted(async () => {
playerStore.loadTheme();
connect();
playerStore.fetchBots();
syncTimer = setInterval(() => playerStore.syncElapsed(), 3000);
mobileRaf = requestAnimationFrame(updateMobileProgress);
// Reconcile the dedicated-link scope only after the bot list is known: the
// router guard sets scopedBotId tentatively from ?bot, but applyScopeFromQuery
// validates it against the loaded bots (locks if it exists, clears if stale).
await playerStore.fetchBots();
const qBot = typeof route.query.bot === 'string' ? route.query.bot : null;
playerStore.applyScopeFromQuery(qBot);
});
onUnmounted(() => {