fix: improve session initialization flow

- Fixed onMounted to properly set currentSession after creating default
- Ensure loadSessions is called after createSession to refresh list
This commit is contained in:
2026-10-27 06:16:17 +08:00
parent 433b5dc797
commit 06217bc314

View File

@@ -607,12 +607,12 @@ onMounted(async () => {
// Auto-create default session if none exists // Auto-create default session if none exists
if (!sessionList.value.length) { if (!sessionList.value.length) {
const defaultSession = await createSession('Default', 'keyword') const newSession = await createSession('Default', 'keyword')
if (defaultSession) { if (newSession) {
setCurrentSession(defaultSession) setCurrentSession(newSession)
await loadSessions()
} }
} else { } else {
await loadSessions()
// Set first session as current // Set first session as current
if (sessionList.value.length && !currentSession.value) { if (sessionList.value.length && !currentSession.value) {
setCurrentSession(sessionList.value[0]) setCurrentSession(sessionList.value[0])