Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/pages/AccountList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ import { useAuthStore } from '../stores/auth'
import { useAccountStore } from '../stores/account'
import { useConfigStore } from '../stores/config'
import { useGameStore, gameCodeOf, imageUrl } from '../stores/game'
import { useUiStore } from '../stores/ui'
import { commands, type LoginRegion, type ServiceAccount } from '../types/bindings'
import {
CommandInvocationError,
Expand Down Expand Up @@ -156,6 +157,14 @@ const account = useAccountStore()
* not a generic settings object).
*/
const configStore = useConfigStore()
const ui = useUiStore()

/*
* One-shot flag: auto-start game on the first successful loadList
* after mount. Cleared after first use so retry / game-switch
* don't re-trigger.
*/
let pendingAutoStart = true
/*
* D8 — game store wire-in. Aliased to `game` (matching the
* `account` / `auth` / `configStore` alias style used above).
Expand Down Expand Up @@ -222,6 +231,16 @@ async function loadList(): Promise<void> {
}

loadState.value = 'ready'

// Auto-start game after first load if the setting is enabled.
// Mirrors WPF `loginWorker_RunWorkerCompleted` L1421-1429.
// Only fires once per mount (not on retry / game switch).
if (pendingAutoStart) {
pendingAutoStart = false
if (ui.autoStartGame && account.serviceAccounts.length > 0) {
void handleStartGame()
}
}
} catch (err) {
/*
* `account.getServiceAccounts` funnels through `wrapCommand`,
Expand Down
Loading