fix(gui): refresh the macOS device menu when inventory changes - #456
fix(gui): refresh the macOS device menu when inventory changes#456Phecda wants to merge 2 commits into
Conversation
Greptile SummaryThis PR fixes the macOS Device menu staying frozen on "No devices connected" after inventory loads, by calling
Confidence Score: 5/5Safe to merge — the change is a focused, well-reasoned bug fix with no regressions introduced. Both changes are minimal and correct. The merged flag is already computed inside update_global and simply needed to be surfaced; the rebuild is gated precisely on inventory changes, matching the condition that actually mutates the Device submenu content. The NoAction substitution removes a misleading action reference from items that are always disabled. Hardware testing confirms the fix works end-to-end. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| crates/openlogi-gui/src/app_menu.rs | Replaces OpenSettings with gpui::NoAction for disabled informational Device menu entries; semantically correct change with no functional impact since items are always .disabled(true). |
| crates/openlogi-gui/src/main.rs | Adds merged to the update_global return tuple and calls app_menu::rebuild only when inventory actually changed, correctly fixing the stale Device menu bug without over-triggering on agent-link-only status updates. |
Sequence Diagram
sequenceDiagram
participant Agent
participant MainLoop as Main Loop (Tokio)
participant AppState
participant GPUI as GPUI (cx)
participant Menu as macOS Menu Bar
Agent->>MainLoop: GuiUpdate::Snapshot(update)
MainLoop->>AppState: refresh_inventories() → merged
MainLoop->>AppState: set_agent_link() → link_changed
Note over AppState: changed = merged | link_changed
AppState-->>MainLoop: (changed, merged, ...)
alt "changed == true"
MainLoop->>GPUI: cx.refresh_windows()
end
alt "merged == true"
MainLoop->>GPUI: app_menu::rebuild(cx)
GPUI->>Menu: cx.set_menus(menus(cx))
Note over Menu: Device submenu now lists current device records
end
Reviews (2): Last reviewed commit: "fix(gui): rebuild device menu only for i..." | Re-trigger Greptile
Summary
Keep the native macOS Device menu synchronized with the device records shown by the GUI.
Changes
openlogi-gui: rebuild the application menu when an agent update changes the displayed state, without rebuilding it for unchanged polling snapshots.NoActionfor informational disabled menu entries instead of routing them through Settings actions.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceNo devices connected.Fixes #455