Files
clawpanel/src-tauri
晴天 e39233f2c1 fix(lifecycle): 卸载/升级 OpenClaw 后同步刷新 Rust 缓存与前端缓存
这是 #Compat-4(安装不识别修复)的收尾补丁。除了 setup 安装场景,
OpenClaw 的卸载和升级场景也存在类似的缓存失效问题。

## Rust 端:uninstall_openclaw_inner 卸载后刷缓存

卸载完成时只 emit 了 "upgrade-progress 100",但没有刷 enhanced_path
和 CLI 检测缓存。后果:

- `is_cli_installed`(60s TTL)在卸载后 60 秒内仍返回 true,UI 显示
  「CLI 已安装」
- 服务状态页 gateway 被误判为还在运行

在 emit 进度 100 之后立刻调用:
- `super::refresh_enhanced_path()`
- `crate::commands::service::invalidate_cli_detection_cache()`

## 前端:upgrade/uninstall/installGateway/uninstallGateway 清前端缓存

`upgrade_openclaw` / `uninstall_openclaw` / `install_gateway` /
`uninstall_gateway` 这四个 API 会改变 CLI 状态或 Gateway 状态,但
原先直接 invoke,没有清前端的 cachedInvoke 缓存。Rust 端自己刷了
缓存没用,前端仍吃旧的 `check_installation` / `get_services_status`
/ `get_version_info` 缓存(60s / 10s / 30s TTL)。

统一在调用前 invalidate 相关缓存:

- upgrade/uninstall OpenClaw → 清 check_installation / check_node /
  check_git / get_services_status / get_status_summary / get_version_info
- install/uninstall Gateway → 清 get_services_status / get_status_summary

## 验证

- `cargo check` 通过
- `npm run build` 通过
2026-04-20 12:46:06 +08:00
..
2026-02-26 22:34:55 +08:00
2026-04-16 13:55:26 +08:00
2026-04-16 13:55:26 +08:00