diff --git a/electron/src/renderer/App.tsx b/electron/src/renderer/App.tsx index 791b056..2bf6601 100644 --- a/electron/src/renderer/App.tsx +++ b/electron/src/renderer/App.tsx @@ -104,6 +104,7 @@ function AmadeusApp() { const handleToggleWallpaper = useCallback(async () => { const next = !wallpaperActive setPage('chat') + setWallpaperActive(next) if (next) { if (renderActive) { @@ -114,10 +115,10 @@ function AmadeusApp() { } try { const res = await send('wallpaper.start', ELECTRON_SLICE_START_PARAMS) - setWallpaperActive(res?.status !== 'error') - if (res?.status !== 'error') await syncElectronSliceHost(res) + if (res?.status === 'error') setWallpaperActive(false) // 失败回退 + else await syncElectronSliceHost(res) } catch { - setWallpaperActive(false) + setWallpaperActive(false) // 失败回退 } } else { try { await send('wallpaper.stop', {}) } catch {}