fix(ui): stop archived and deleted tasks from showing in global search#3162
fix(ui): stop archived and deleted tasks from showing in global search#3162igennova wants to merge 3 commits into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Reviews (1): Last reviewed commit: "Merge branch 'main' into 3161" | Re-trigger Greptile |
| const visibleTasks = tasks.filter( | ||
| (task) => !archivedTaskIds.has(task.id) && Boolean(workspaces?.[task.id]), | ||
| ); | ||
| if (!visibleTasks.length) return []; | ||
| return [ |
There was a problem hiding this comment.
Tasks hidden while workspaces are loading
When the component first mounts and the workspaces query hasn't resolved yet, workspaces is undefined, so Boolean(workspaces?.[task.id]) is false for every task — the command menu shows zero tasks until the query returns. The sidebar guards against this exact scenario by checking isWorkspacesFetched before treating an empty list as real data. Since useWorkspaces has a staleTime of one minute and the sidebar loads it on startup, the window is narrow in practice, but users who open the command menu during a cold load or after a cache miss will briefly see no tasks at all.
Summary
Fixes #3161
Problem
The command menu built its "Tasks" section directly from
useTasks()with no visibility filtering:archivedTaskIds, so archived tasks appeared in search.Solution
In
CommandMenu.tsx, filter tasks to!archivedTaskIds.has(task.id) && Boolean(workspaces?.[task.id])before building the search results. Because the workspaces query sharesWORKSPACE_QUERY_KEY(already invalidated on archived-task delete), deleted tasks drop out of search immediately.Video
Screen.Recording.2026-07-06.at.9.55.28.AM.mov
Notes