-
Notifications
You must be signed in to change notification settings - Fork 53
fix(ui): stop archived and deleted tasks from showing in global search #3162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { | |
| EnvelopeSimple, | ||
| HashIcon, | ||
| } from "@phosphor-icons/react"; | ||
| import { workspaceIdSet } from "@posthog/core/command-center/eligibility"; | ||
| import { | ||
| Autocomplete, | ||
| AutocompleteCollection, | ||
|
|
@@ -23,6 +24,7 @@ import { | |
| type CommandMenuAction, | ||
| } from "@posthog/shared/analytics-events"; | ||
| import type { Task } from "@posthog/shared/domain-types"; | ||
| import { useArchivedTaskIds } from "@posthog/ui/features/archive/useArchivedTaskIds"; | ||
| import { useChannels } from "@posthog/ui/features/canvas/hooks/useChannels"; | ||
| import { useTaskChannelMap } from "@posthog/ui/features/canvas/hooks/useTaskChannelMap"; | ||
| import { useReviewNavigationStore } from "@posthog/ui/features/code-review/reviewNavigationStore"; | ||
|
|
@@ -43,6 +45,7 @@ import { TaskIcon } from "@posthog/ui/features/sidebar/components/items/TaskIcon | |
| import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore"; | ||
| import { useTaskPrStatus } from "@posthog/ui/features/sidebar/useTaskPrStatus"; | ||
| import { useTasks } from "@posthog/ui/features/tasks/useTasks"; | ||
| import { useWorkspaces } from "@posthog/ui/features/workspace/useWorkspace"; | ||
| import { | ||
| goBackInHistory, | ||
| goForwardInHistory, | ||
|
|
@@ -143,6 +146,8 @@ export function CommandMenu({ open, onOpenChange }: CommandMenuProps) { | |
| (state) => state.getReviewMode, | ||
| ); | ||
| const { data: tasks = [] } = useTasks(); | ||
| const archivedTaskIds = useArchivedTaskIds(); | ||
| const { data: workspaces, isFetched: workspacesFetched } = useWorkspaces(); | ||
| const [query, setQuery] = useState(""); | ||
| const { repoPath } = useFileSearchContext(); | ||
| const canSearchFiles = !!repoPath; | ||
|
|
@@ -387,11 +392,17 @@ export function CommandMenu({ open, onOpenChange }: CommandMenuProps) { | |
| ]); | ||
|
|
||
| const taskSections = useMemo<CommandSection[]>(() => { | ||
| if (tasks.length === 0) return []; | ||
| const workspaceIds = workspaceIdSet(workspaces); | ||
| const visibleTasks = tasks.filter( | ||
| (task) => | ||
| !archivedTaskIds.has(task.id) && | ||
| (!workspacesFetched || workspaceIds.has(task.id)), | ||
| ); | ||
| if (!visibleTasks.length) return []; | ||
| return [ | ||
|
Comment on lines
+396
to
402
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the component first mounts and the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Applied both suggestion in 6585b3b |
||
| { | ||
| label: "Tasks", | ||
| items: tasks.map((task) => { | ||
| items: visibleTasks.map((task) => { | ||
| const channel = taskChannelMap.get(task.id); | ||
| return { | ||
| id: `task-${task.id}`, | ||
|
|
@@ -417,7 +428,15 @@ export function CommandMenu({ open, onOpenChange }: CommandMenuProps) { | |
| }), | ||
| }, | ||
| ]; | ||
| }, [tasks, taskChannelMap, bluebirdEnabled, closeSettingsDialog]); | ||
| }, [ | ||
| tasks, | ||
| archivedTaskIds, | ||
| workspaces, | ||
| workspacesFetched, | ||
| taskChannelMap, | ||
| bluebirdEnabled, | ||
| closeSettingsDialog, | ||
| ]); | ||
|
|
||
| const channelSections = useMemo<CommandSection[]>(() => { | ||
| if (channels.length === 0) return []; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.