wonfen:托盘延迟菜单宜用 set_text/set_checked 更新而非整体重建,并需要可靠的刷新触发
在「feat(tray): add a per-group latency test」PR 中,wonfen 请作者把 (a)(b) 两处本地修复推到该 PR 上;对 (c) 同意在只更新延迟或选中状态时用 `set_text` 与 `set_checked` 更新既有菜单项,而不是重建整个菜单,并指出当前 `latency_items` 只登记测试按钮,需要扩展到代理行。刷新触发也需要可靠方案:在菜单打开时更新只能在下次打开显示结果,无法反映菜单保持打开期间的自动测试;Tauri 在 Linux 上不发出托盘点击事件,仅靠点击无法覆盖所有平台,需在保留现有同步且读取失败不致命的前提下处理。
作者原文@wonfenThanks for checking these cases. Could you push your local fixes for (a) and (b) to this PR? We can review and build on those changes.
For (c), I agree that updating existing menu items with
set_textandset_checkedis preferable to rebuilding the whole menu when only latency or selection changes. The currentlatency_itemsregistry only tracks the test-action buttons, so we would need to extend it to track the proxy rows as well.We also need a reliable refresh trigger: updating on menu opening would show recent results on the next open, but would not necessarily reflect automatic tests while the menu stays open. Tauri does not emit tray click events on Linux, so a click-only approach would not cover every platform. We should account for that while preserving the existing synchronization and keeping failed reads nonfatal.