feat(settings): context-aware Cmd+K settings search (from #349) - #399
Conversation
While the Settings page is open, the global Cmd+K palette switches to "Search settings…" mode: it filters an index of the app's settings and navigates to the tab each one lives on, instead of searching notes. Ported from @Vassista's PR #349 and adapted to the current nav-rail Settings design — the search index is retargeted to the current tab ids (transcription settings map to the AI tab; adds About), and Settings.tsx now re-derives its visible tab from the route param after mount so a selection switches tabs even when Settings is already open. Does not touch the Settings layout/look. Adds a T1 spec covering settings-mode search + the route-reactive tab switch. Co-authored-by: Vassista <vassista@icloud.com>
There was a problem hiding this comment.
1 issue found across 3 files
You’re at about 90% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/renderer/src/routes/Settings.tsx">
<violation number="1" location="app/renderer/src/routes/Settings.tsx:93">
P2: Changing the hash from a valid deep link such as `/settings?tab=ai` to `/settings` (or to an invalid tab) leaves the old tab visible because this effect has no fallback branch. The route-sync logic should also reset `tab` to `'general'` when `requested` is absent or invalid, matching the mount behavior.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| if (requested && (DEEP_LINK_IDS as readonly string[]).includes(requested)) { | ||
| setTab(resolveTab(requested as DeepLinkId)); | ||
| } |
There was a problem hiding this comment.
P2: Changing the hash from a valid deep link such as /settings?tab=ai to /settings (or to an invalid tab) leaves the old tab visible because this effect has no fallback branch. The route-sync logic should also reset tab to 'general' when requested is absent or invalid, matching the mount behavior.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/renderer/src/routes/Settings.tsx, line 93:
<comment>Changing the hash from a valid deep link such as `/settings?tab=ai` to `/settings` (or to an invalid tab) leaves the old tab visible because this effect has no fallback branch. The route-sync logic should also reset `tab` to `'general'` when `requested` is absent or invalid, matching the mount behavior.</comment>
<file context>
@@ -84,6 +84,16 @@ export function Settings() {
+ // so without this the hash would update but the tab wouldn't switch.
+ React.useEffect(() => {
+ const requested = getRouteParam(route, 'tab');
+ if (requested && (DEEP_LINK_IDS as readonly string[]).includes(requested)) {
+ setTab(resolveTab(requested as DeepLinkId));
+ }
</file context>
| if (requested && (DEEP_LINK_IDS as readonly string[]).includes(requested)) { | |
| setTab(resolveTab(requested as DeepLinkId)); | |
| } | |
| if (requested && (DEEP_LINK_IDS as readonly string[]).includes(requested)) { | |
| setTab(resolveTab(requested as DeepLinkId)); | |
| } else { | |
| setTab('general'); | |
| } |
- Match the real label 'Post meeting notifications' (no hyphen) so the displayed setting is findable (cubic P3, conf 10). - Trim the query before filtering settings so leading/trailing whitespace still matches (cubic P3, conf 10). - Guard aria-activedescendant against a transiently out-of-range selection after the list shrinks (cubic P3). - Add Storage location + Scheduled meetings to the index and surface the menu-bar/tray icon setting, so more visible settings are discoverable (cubic P2). - Reset templateEditorOpen when leaving the Templates tab (via nav or search) so a stale flag can't suppress the page header (cubic P2). - Extend the T1 spec to cover the trim + real-label match.
|
Addressed the cubic review in dd2faaf:
Not changing — P2 (Settings.tsx: navigating to |
Summary
Adds context-aware
Cmd+Kto Settings: while the Settings page is open, the global command palette switches to "Search settings…" mode — it filters an index of the app's settings (theme, microphone, AI provider, export, …) and jumps to the tab each one lives on, instead of searching notes.This is the settings-search piece of @Vassista's #349, extracted and adapted to the current nav-rail Settings design so it does not change how Settings looks.
What changed
CommandPalette.tsx— when the route is/settings, the palette searches aSETTINGS_INDEXand navigates to/settings?tab=<id>. Placeholder/aria/empty-state all switch to settings mode; note search is unchanged elsewhere. The index is retargeted to the current tabs (transcription settings live on the AI tab now; added an About entry) — the original PR's index used the pre-v0.6.2 tab layout.Settings.tsx— the visible tab now re-derives from the?tab=param after mount (previously mount-only), so selecting a result switches tabs even when Settings is already open. Purely behavioral — no layout/visual change.Why not just merge #349
#349 is 17 commits stale and its centrepiece is a Settings-UI refactor that predates (and would undo) the v0.6.2 nav-rail redesign. This PR takes only the search, rebuilt on the current design. Cloud transcription, notification, and other pieces of #349 are being extracted as separate PRs.
Tests
settings-cmdk-search.t1.spec.ts: settings-mode search + filtering, and the route-reactive tab switch (jump from the AI tab to a General-tab setting). Existing notes-search palette specs still pass.typecheck:renderergreen.Credit: @Vassista (#349).
Summary by cubic
Adds context-aware Cmd+K to Settings: while on
/settings, the palette switches to “Search settings…” and jumps to the right tab. Note search stays the same elsewhere./settings, filters a settings index, and opens/settings?tab=…for the selected item; placeholder/aria/empty-state switch to settings mode. Note search is unchanged on other routes.?tab=changes after mount so selections switch tabs even when Settings is already open; adds a T1 spec covering settings-mode search, query trimming, and tab switching.aria-activedescendantwhen the list shrinks, match real labels (e.g., “Post meeting notifications”), and expand the index (Scheduled meetings, Storage location, dock icon); reset the Templates editor flag when leaving that tab.Written for commit dd2faaf. Summary will update on new commits.