Skip to content

fix(ui): stop archived and deleted tasks from showing in global search#3162

Open
igennova wants to merge 3 commits into
PostHog:mainfrom
igennova:3161
Open

fix(ui): stop archived and deleted tasks from showing in global search#3162
igennova wants to merge 3 commits into
PostHog:mainfrom
igennova:3161

Conversation

@igennova

@igennova igennova commented Jul 6, 2026

Copy link
Copy Markdown

Summary

  • Filter the command menu (global search) task list to exclude archived tasks and archived-then-deleted tasks.
  • Search now mirrors the sidebar and command center: a task appears only when it is not archived and still has a workspace.

Fixes #3161

Problem

The command menu built its "Tasks" section directly from useTasks() with no visibility filtering:

  • It never checked archivedTaskIds, so archived tasks appeared in search.
  • It never checked workspace presence, so archived-then-deleted tasks appeared too.

Solution

In CommandMenu.tsx, filter tasks to !archivedTaskIds.has(task.id) && Boolean(workspaces?.[task.id]) before building the search results. Because the workspaces query shares WORKSPACE_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

  • This narrows global search to tasks with a local workspace, matching the sidebar and command center. Tasks without a workspace row no longer appear in search.
  • Follow-up (separate): make archived-task delete also delete the cloud task record so "delete" is permanent everywhere without per-surface filtering.

@trunk-io

trunk-io Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "Merge branch 'main' into 3161" | Re-trigger Greptile

Comment thread packages/ui/src/features/command/CommandMenu.tsx
Comment on lines +394 to 398
const visibleTasks = tasks.filter(
(task) => !archivedTaskIds.has(task.id) && Boolean(workspaces?.[task.id]),
);
if (!visibleTasks.length) return [];
return [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied both suggestion in 6585b3b

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.

Global search shows archived/deleted tasks

1 participant