fix(settings): make Cmd+, only open settings, never toggle#1898
Merged
Davidknp merged 1 commit intogeneralaction:mainfrom May 6, 2026
Conversation
Both the macOS menu accelerator and the in-app hotkey for Cmd+,
fired navigate('settings') unconditionally. When already on the
settings view, double-fires through the closeModal side-effect
could appear as a toggle. Guard both paths with a currentView
check so pressing the shortcut on the settings view is a no-op.
Refs ENG-990
Contributor
Greptile SummaryThis PR prevents
Confidence Score: 5/5Safe to merge — the change is narrow, both code paths are handled consistently, and no regressions are introduced. Both touch points (hotkey handler and IPC menu listener) receive the same guard. The useEffect dependency array in app-menu-events.tsx is correctly updated so the closure always reflects the latest currentView, avoiding any stale-capture bug. The logic is straightforward and easy to verify. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/renderer/lib/components/app-keyboard-shortcuts.tsx | Adds a currentView !== 'settings' guard to the hotkey handler; currentView was already in scope from an existing useWorkspaceSlots() call, so no new hook is needed. |
| src/renderer/app/app-menu-events.tsx | Introduces useWorkspaceSlots() to obtain currentView, applies the same early-return guard inside the IPC listener, and properly adds currentView to the effect's dependency array to keep the closure fresh. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Cmd+, pressed\n(hotkey or menu)"] --> B{"currentView\n=== 'settings'?"}
B -- "Yes (already on settings)" --> C["Return — do nothing"]
B -- "No" --> D{"onOpenSettings\ncallback returns false?\n(menu path only)"}
D -- "Yes" --> C
D -- "No / not present" --> E["navigate('settings')"]
Reviews (1): Last reviewed commit: "fix(settings): make Cmd+, only open sett..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
fixes settings shortcut