This commit is contained in:
2026-02-06 20:03:56 +08:00
parent c383f9063d
commit c6435c6db5
2 changed files with 15 additions and 1 deletions

View File

@@ -517,7 +517,11 @@ const saveToLocalStorage = () => {
const saveToFile = async () => {
if (!isElectronEnv) return
try {
await window.electronAPI.saveRunConfig(JSON.parse(JSON.stringify(config.value)))
const configToSave = JSON.parse(JSON.stringify(config.value))
// ConfigPage 不管理 filtersHostListDialog 会单独管理
// 删除 filters 避免用 ConfigPage 中可能过期的状态覆盖后端
delete configToSave.filters
await window.electronAPI.saveRunConfig(configToSave)
} catch (e) {
console.error('保存配置失败:', e)
}
@@ -706,6 +710,15 @@ const handleStart = async (specificGroupIndex) => {
}
}
// 预热所有视图,确保后台视图完成渲染,解决自动化执行失败问题
try {
console.log('[ConfigPage] 预热所有视图...')
await window.electronAPI.warmUpViews()
console.log('[ConfigPage] 视图预热完成')
} catch (e) {
console.warn('[ConfigPage] 视图预热失败,继续启动:', e)
}
const results = await Promise.allSettled(
startTasks.map(async ({ viewId, account, delay }) => {
await new Promise(r => setTimeout(r, delay))

View File

@@ -81,6 +81,7 @@ export interface ElectronAPI {
// 基础视图控制
hideViews: () => Promise<{ success: boolean }>
showViews: () => Promise<{ success: boolean }>
warmUpViews: () => Promise<{ success: boolean; error?: string }>
switchTab: (tab: TabId) => Promise<{ success: boolean; currentTab?: TabId; error?: string }>
switchToView: (viewId: number) => Promise<{ success: boolean; currentViewId?: number; error?: string }>
getCurrentTab: () => Promise<TabId>