Skip to content

feat(sidebar): add search trigger that opens the command palette#2072

Merged
jschwxrz merged 2 commits into
generalaction:mainfrom
mezotv:emdash/eight-mails-worry-pjxsu
May 18, 2026
Merged

feat(sidebar): add search trigger that opens the command palette#2072
jschwxrz merged 2 commits into
generalaction:mainfrom
mezotv:emdash/eight-mails-worry-pjxsu

Conversation

@mezotv
Copy link
Copy Markdown
Contributor

@mezotv mezotv commented May 17, 2026

Summary

  • Adds a click-through search input above the projects list in the left sidebar that opens the ⌘K command palette modal, pre-populated with the current project/task/workspace context.

Test plan

  • Click the search input in the sidebar — command palette opens
  • Keyboard shortcut (⌘K) still works
  • ⌘K hint right-aligns with the "5m ago" timestamps in task rows

Click-through input above pinned tasks and projects that opens the ⌘K
modal with the current project/task/workspace context.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 17, 2026

Greptile Summary

This PR adds a SidebarSearchTrigger component — a non-interactive-looking button at the top of the left sidebar that opens the command palette (⌘K) pre-populated with the current view's project, task, and workspace context.

  • The new component correctly derives currentProjectId from either the task or project view params, sets currentTaskId only when in the task view, and gates workspaceId lookup behind both being present — matching the semantic that a workspaceId is task-scoped.
  • The placement in left-sidebar.tsx is a clean one-liner above SidebarPinnedTaskList.
  • Minor style nits: a redundant ?? undefined expression and the convention of using a plain function component with ad-hoc useObserver rather than the observer() HOC used elsewhere in the sidebar.

Confidence Score: 4/5

Safe to merge; the change is additive and well-scoped to the sidebar UI with no side effects on existing flows.

The context-derivation logic is correct: projectId, taskId, and workspaceId are each gated appropriately behind the active view. Both nits are cosmetic and carry no runtime risk.

src/renderer/features/sidebar/sidebar-search-trigger.tsx — the new component with the minor style issues mentioned above.

Important Files Changed

Filename Overview
src/renderer/features/sidebar/sidebar-search-trigger.tsx New component that renders a clickable search trigger in the sidebar; correctly derives context-aware projectId/taskId/workspaceId and forwards them to the command palette. Minor style issue with a redundant ?? undefined expression.
src/renderer/features/sidebar/left-sidebar.tsx Trivial one-line insertion of <SidebarSearchTrigger /> above the pinned task list; import added correctly, no structural changes.

Sequence Diagram

sequenceDiagram
    participant User
    participant SidebarSearchTrigger
    participant useWorkspaceSlots
    participant useParams
    participant getRegisteredTaskData
    participant CommandPalette

    User->>SidebarSearchTrigger: click search button
    SidebarSearchTrigger->>useWorkspaceSlots: read currentView
    SidebarSearchTrigger->>useParams: read taskParams / projectParams
    SidebarSearchTrigger->>getRegisteredTaskData: lookup workspaceId (task view only)
    SidebarSearchTrigger->>CommandPalette: "showCommandPalette({ projectId, taskId, workspaceId })"
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
src/renderer/features/sidebar/sidebar-search-trigger.tsx:24
The `?? undefined` at the end is redundant: `?.workspaceId` already evaluates to `undefined` when the optional chain short-circuits (the `??` operator only replaces `null` or `undefined`, so it only has any effect if `workspaceId` can be `null` — which would be worth confirming against the `Task` type). In the common case this has no runtime impact but adds noise.

```suggestion
    return getRegisteredTaskData(currentProjectId, currentTaskId)?.workspaceId;
```

### Issue 2 of 2
src/renderer/features/sidebar/sidebar-search-trigger.tsx:8
`SidebarSearchTrigger` is a plain function component that relies on three separate `useObserver` calls (inside `useWorkspaceSlots`, `useParams`, and the explicit one for `currentWorkspaceId`) rather than a single `observer()` wrapper. Every other reactive component in the sidebar (e.g. `LeftSidebar`) uses the `observer()` HOC. While the hybrid approach is technically valid, it means each `useObserver` creates an independent subscription/reaction scope, so a change to navigation params triggers multiple separate re-render passes instead of one. Wrapping the component with `observer()` and removing the explicit `useObserver` call for `currentWorkspaceId` would align with the codebase convention and be slightly more efficient.

Reviews (1): Last reviewed commit: "feat(sidebar): add search trigger that o..." | Re-trigger Greptile

Comment thread src/renderer/features/sidebar/sidebar-search-trigger.tsx Outdated
Comment thread src/renderer/features/sidebar/sidebar-search-trigger.tsx Outdated
- Wrap in observer() instead of explicit useObserver
- Drop redundant ?? undefined on optional-chained workspaceId
@jschwxrz jschwxrz merged commit dade06a into generalaction:main May 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants