Skip to content

fix(webapp): 睡眠唤醒后自动刷新 GUI,避免白屏 - #5839

Open
xuanmossdx wants to merge 1 commit into
LmeSzinc:masterfrom
xuanmossdx:fix/webapp-reload-on-system-resume
Open

fix(webapp): 睡眠唤醒后自动刷新 GUI,避免白屏#5839
xuanmossdx wants to merge 1 commit into
LmeSzinc:masterfrom
xuanmossdx:fix/webapp-reload-on-system-resume

Conversation

@xuanmossdx

@xuanmossdx xuanmossdx commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • 电脑睡眠/休眠唤醒后,Alas Electron 桌面端常见白屏,需重启或 Ctrl+R。
  • 根因:壳层 iframe 中的 PyWebIO WebSocket/会话在睡眠时断开,唤醒后不自动重连;实测 gui.py 与 127.0.0.1:端口 仍可用。
  • 修复:监听 powerMonitorresume,防抖约 1 秒后 mainWindow.reload()(与现有 Ctrl+R 相同路径)。

Test plan

  • 打补丁前:睡眠唤醒后白屏;Ctrl+R 可恢复;浏览器仍可打开 WebUI
  • 打补丁后:两次睡眠唤醒均自动恢复,无需手动刷新
  • resume 日志确认触发了 resume eventreload after resume

Notes

  • 仅改 webapp/packages/main/src/index.ts;需发新版 webapp / 替换 app.asar 后对用户生效。
  • 若 reload 后仍白屏且浏览器也打不开,属于 Python/webui 进程已挂,不在本 PR 范围。

…sleep

Sleep/hibernate disconnects the PyWebIO websocket session inside the Electron iframe; auto-reload on powerMonitor resume restores the UI (same as Ctrl+R).
@xuanmossdx
xuanmossdx force-pushed the fix/webapp-reload-on-system-resume branch 2 times, most recently from 8356e6f to 5efdcf0 Compare July 24, 2026 02:46
@xuanmossdx xuanmossdx closed this Jul 24, 2026
@xuanmossdx xuanmossdx reopened this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant