:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(desktop): show file-to progress (#104247)
Paul D'Ambrac2adfd879bae
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelBreadcrumb.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelBreadcrumb.tsxindex d625e0bf7e92..1087e37c598d 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelBreadcrumb.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelBreadcrumb.tsx@@ -22,6 +22,7 @@ import {BreadcrumbSeparator,} from "@posthog/ui/primitives/Breadcrumb";import { LEADING_BUTTON_PULL } from "@posthog/ui/primitives/ChromeBar";+import { Spinner } from "@posthog/ui/primitives/Spinner";import { toast } from "@posthog/ui/primitives/toast";import { track } from "@posthog/ui/shell/analytics";import { Flex } from "@radix-ui/themes";@@ -63,6 +64,7 @@ interface ChannelBreadcrumbProps {* unrelated once the bar's width separates them from the name.*/leafTrailing?: ReactNode;+ isLoading?: boolean;}// "# channel / leaf" header breadcrumb shared across channel scenes (CONTEXT.md,@@ -80,6 +82,7 @@ export function ChannelBreadcrumb({onRename,trailing,leafTrailing,+ isLoading = false,}: ChannelBreadcrumbProps) {const spacesLayout = useChannelsLayout();// Only a leaf is renamable, so the scope key falls back to its label.@@ -91,25 +94,31 @@ export function ChannelBreadcrumb({const atChannelHome = channelId ? pathname === `/spaces/${channelId}` : false;const channelSegment = (- <BreadcrumbSegment- icon={channelGlyph(channelName, {- size: 12,- space: spacesLayout,- className: "shrink-0 text-muted-foreground/80",- })}- label={channelName}- strong- onClick={- channelId && !atChannelHome- ? () =>- void navigate({- to: "/spaces/$channelId",- params: { channelId },- })- : undefined- }- contextMenu={Boolean(channelId)}- />+ <span+ className="flex items-center gap-1"+ aria-busy={isLoading || undefined}+ >+ <BreadcrumbSegment+ icon={channelGlyph(channelName, {+ size: 12,+ space: spacesLayout,+ className: "shrink-0 text-muted-foreground/80",+ })}+ label={channelName}+ strong+ onClick={+ channelId && !atChannelHome+ ? () =>+ void navigate({+ to: "/spaces/$channelId",+ params: { channelId },+ })+ : undefined+ }+ contextMenu={Boolean(channelId)}+ />+ {isLoading ? <Spinner size="xs" aria-hidden="true" /> : null}+ </span>);return (diff --git a/products/desktop/packages/ui/src/features/canvas/components/TaskRowMenu.tsx b/products/desktop/packages/ui/src/features/canvas/components/TaskRowMenu.tsxindex b422a16cd531..36309e53dc6a 100644--- a/products/desktop/packages/ui/src/features/canvas/components/TaskRowMenu.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/TaskRowMenu.tsx@@ -157,7 +157,7 @@ function TaskRowMenuItems({const isTask = menu.kind === "task";const analysisTask = isTask && menu.task?.latest_run ? menu.task : null;const { channels } = useChannels({ enabled: bluebirdEnabled });- const fileToChannel = useFileTaskToChannel();+ const fileToChannel = useFileTaskToChannel({ enabled: bluebirdEnabled });const openBrowserTab = useOpenBrowserTab();const channelItems: MenuFlyoutItem[] = channels.map((channel) => ({diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.test.tsx b/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.test.tsxindex 121b26e8aad7..bad92a9c0f1e 100644--- a/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.test.tsx@@ -1,3 +1,7 @@+import type { Task } from "@posthog/shared/domain-types";+import { channelFeedQueryRoot } from "@posthog/ui/features/canvas/hooks/useChannelFeed";+import { useFilingTasksStore } from "@posthog/ui/features/canvas/stores/filingTasksStore";+import { taskKeys } from "@posthog/ui/features/tasks/taskKeys";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { act, renderHook } from "@testing-library/react";import type { ReactNode } from "react";@@ -54,7 +58,10 @@ describe("useChannelTaskMutations", () => {queryClient.getQueryCache().getAll()- .filter((query) => query.state.isInvalidated)+ .filter(+ (query) =>+ query.state.isInvalidated && Array.isArray(query.queryKey[0]),+ ).map((query) =>(query.queryKey[1] as { input: { channelId: string } }).input@@ -64,6 +71,7 @@ describe("useChannelTaskMutations", () => {beforeEach(() => {vi.clearAllMocks();+ useFilingTasksStore.setState({ filingTasks: {} });queryClient = new QueryClient({defaultOptions: { queries: { retry: false } },});@@ -72,6 +80,13 @@ describe("useChannelTaskMutations", () => {queryClient.setQueryData(listKey("source"), [{ taskId: "t1" }]);queryClient.setQueryData(listKey("dest"), [{ taskId: "t2" }]);queryClient.setQueryData(listKey("unrelated"), [{ taskId: "t3" }]);+ queryClient.setQueryData<Task[]>(taskKeys.list(), [+ { id: "t1", channel: "source" } as Task,+ ]);+ queryClient.setQueryData<Task>(taskKeys.detail("t1"), {+ id: "t1",+ channel: "source",+ } as Task);});it("filing a task invalidates only its old and new channel", async () => {@@ -82,6 +97,12 @@ describe("useChannelTaskMutations", () => {});expect(invalidatedChannels()).toEqual(["dest", "source"]);+ expect(queryClient.getQueryData<Task[]>(taskKeys.list())?.[0].channel).toBe(+ "dest",+ );+ expect(queryClient.getQueryData<Task>(taskKeys.detail("t1"))?.channel).toBe(+ "dest",+ );});it("filing a task invalidates a channel whose list is still loading", async () => {@@ -100,7 +121,23 @@ describe("useChannelTaskMutations", () => {expect(invalidatedChannels()).toEqual(["dest", "loading", "source"]);});+ it("refreshes cached space feeds after filing", async () => {+ const feedKey = [...channelFeedQueryRoot, "source"];+ queryClient.setQueryData(feedKey, [{ taskId: "t1" }]);+ const { result } = renderHook(() => useChannelTaskMutations(), { wrapper });++ await act(async () => {+ await result.current.fileTask("dest", "t1");+ });++ expect(queryClient.getQueryState(feedKey)?.isInvalidated).toBe(true);+ });+it("unfiling a task invalidates only the channel that listed it", async () => {+ const filing = useFilingTasksStore.getState();+ filing.startFiling("t1", "source");+ filing.completeFiling("t1", "source");+ filing.hideFiledTask("t1", "source");const { result } = renderHook(() => useChannelTaskMutations(), { wrapper });await act(async () => {@@ -108,5 +145,6 @@ describe("useChannelTaskMutations", () => {});expect(invalidatedChannels()).toEqual(["source"]);+ expect(useFilingTasksStore.getState().filingTasks.t1).toBeUndefined();});});diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.tsindex ceb53fcb893d..5c34cc8b6ed8 100644--- a/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.ts+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useChannelTasks.ts@@ -1,6 +1,10 @@import type { ChannelTaskRecord } from "@posthog/core/canvas/channelTaskSchemas";import { useHostTRPC } from "@posthog/host-router/react";+import type { Task } from "@posthog/shared/domain-types";import { AUTH_SCOPED_QUERY_META } from "@posthog/ui/features/auth/useCurrentUser";+import { channelFeedQueryRoot } from "@posthog/ui/features/canvas/hooks/useChannelFeed";+import { useFilingTasksStore } from "@posthog/ui/features/canvas/stores/filingTasksStore";+import { taskKeys } from "@posthog/ui/features/tasks/taskKeys";import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import {SPACE_QUERY_GC_TIME_MS,@@ -32,6 +36,7 @@ export function useChannelTasks(channelId: string | undefined): {export function useChannelTaskMutations() {const trpc = useHostTRPC();const queryClient = useQueryClient();+ const clearFiling = useFilingTasksStore((state) => state.clearFiling);/*** Filing moves a task, so at most two lists change: the channel it lands in@@ -39,6 +44,7 @@ export function useChannelTaskMutations() {* and someone who has browsed a lot of channels holds a lot of those.*/const invalidateAffected = (taskId: string, channelId?: string) => {+ void queryClient.invalidateQueries({ queryKey: channelFeedQueryRoot });if (channelId) {void queryClient.invalidateQueries(trpc.channelTasks.list.queryFilter({ channelId }),@@ -59,13 +65,34 @@ export function useChannelTaskMutations() {const file = useMutation(trpc.channelTasks.file.mutationOptions({- onSuccess: (_data, variables) =>- invalidateAffected(variables.taskId, variables.channelId),+ onSuccess: (_data, variables) => {+ queryClient.setQueriesData<Task[]>(+ { queryKey: taskKeys.lists() },+ (tasks) =>+ tasks?.map((task) =>+ task.id === variables.taskId+ ? { ...task, channel: variables.channelId }+ : task,+ ),+ );+ queryClient.setQueryData<Task | undefined>(+ taskKeys.detail(variables.taskId),+ (task) => (task ? { ...task, channel: variables.channelId } : task),+ );+ invalidateAffected(variables.taskId, variables.channelId);+ void queryClient.invalidateQueries({ queryKey: taskKeys.lists() });+ void queryClient.invalidateQueries({+ queryKey: taskKeys.detail(variables.taskId),+ });+ },}),);const unfile = useMutation(trpc.channelTasks.unfile.mutationOptions({- onSuccess: (_data, variables) => invalidateAffected(variables.taskId),+ onSuccess: (_data, variables) => {+ clearFiling(variables.taskId);+ invalidateAffected(variables.taskId);+ },}),);diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useFileTaskToChannel.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useFileTaskToChannel.tsindex 088227f231e2..a2da1375122b 100644--- a/products/desktop/packages/ui/src/features/canvas/hooks/useFileTaskToChannel.ts+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useFileTaskToChannel.ts@@ -1,5 +1,6 @@import { useChannels } from "@posthog/ui/features/canvas/hooks/useChannels";import { useChannelTaskMutations } from "@posthog/ui/features/canvas/hooks/useChannelTasks";+import { useFilingTasksStore } from "@posthog/ui/features/canvas/stores/filingTasksStore";import { toast } from "@posthog/ui/primitives/toast";import { useCallback } from "react";@@ -9,28 +10,32 @@ import { useCallback } from "react";* tasks the same way — filing is a mutation plus the two toasts that make it* legible, and duplicating that is how the two paths drift.*/-export function useFileTaskToChannel(): (- channelId: string,- taskId: string,- taskTitle: string,-) => Promise<void> {+export function useFileTaskToChannel(options?: {+ enabled?: boolean;+}): (channelId: string, taskId: string, taskTitle: string) => Promise<void> {const { fileTask } = useChannelTaskMutations();- const { channels } = useChannels();+ const { channels } = useChannels({ enabled: options?.enabled });+ const startFiling = useFilingTasksStore((state) => state.startFiling);+ const completeFiling = useFilingTasksStore((state) => state.completeFiling);+ const clearFiling = useFilingTasksStore((state) => state.clearFiling);return useCallback(async (channelId: string, taskId: string) => {+ startFiling(taskId, channelId);try {await fileTask(channelId, taskId);+ completeFiling(taskId, channelId);const channelName = channels.find((channel) => channel.id === channelId,)?.name;toast.success(channelName ? `Filed to ${channelName}` : "Task filed");} catch (error) {+ clearFiling(taskId, channelId);toast.error("Couldn't file task", {description: error instanceof Error ? error.message : String(error),});}},- [channels, fileTask],+ [channels, clearFiling, completeFiling, fileTask, startFiling],);}diff --git a/products/desktop/packages/ui/src/features/canvas/stores/filingTasksStore.ts b/products/desktop/packages/ui/src/features/canvas/stores/filingTasksStore.tsnew file mode 100644index 000000000000..883bf0a38c63--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/stores/filingTasksStore.ts@@ -0,0 +1,60 @@+import { create } from "zustand";++type FilingTaskStatus = "pending" | "complete" | "hidden";++interface FilingTask {+ channelId: string;+ status: FilingTaskStatus;+}++interface FilingTasksStore {+ filingTasks: Record<string, FilingTask | undefined>;+ startFiling: (taskId: string, channelId: string) => void;+ completeFiling: (taskId: string, channelId: string) => void;+ hideFiledTask: (taskId: string, channelId: string) => void;+ clearFiling: (taskId: string, channelId?: string) => void;+}++export const useFilingTasksStore = create<FilingTasksStore>()((set) => ({+ filingTasks: {},+ startFiling: (taskId, channelId) =>+ set((state) => ({+ filingTasks: {+ ...state.filingTasks,+ [taskId]: { channelId, status: "pending" },+ },+ })),+ completeFiling: (taskId, channelId) =>+ set((state) => {+ const filing = state.filingTasks[taskId];+ if (!filing || filing.channelId !== channelId) return state;+ return {+ filingTasks: {+ ...state.filingTasks,+ [taskId]: { ...filing, status: "complete" },+ },+ };+ }),+ hideFiledTask: (taskId, channelId) =>+ set((state) => {+ const filing = state.filingTasks[taskId];+ if (!filing || filing.channelId !== channelId) return state;+ return {+ filingTasks: {+ ...state.filingTasks,+ [taskId]: { ...filing, status: "hidden" },+ },+ };+ }),+ clearFiling: (taskId, channelId) =>+ set((state) => {+ const filing = state.filingTasks[taskId];+ if (+ !filing ||+ (channelId !== undefined && filing.channelId !== channelId)+ )+ return state;+ const { [taskId]: _, ...filingTasks } = state.filingTasks;+ return { filingTasks };+ }),+}));diff --git a/products/desktop/packages/ui/src/features/sidebar/components/TaskListView.tsx b/products/desktop/packages/ui/src/features/sidebar/components/TaskListView.tsxindex 343b73b1f442..9d2723ab39a2 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/TaskListView.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/TaskListView.tsx@@ -13,6 +13,7 @@ import type {} from "@posthog/core/sidebar/sidebarData.types";import { cn, MenuLabel, Text } from "@posthog/quill";import { hoggiePng } from "@posthog/shared/hoggies";+import { useFilingTasksStore } from "@posthog/ui/features/canvas/stores/filingTasksStore";import { useFolders } from "@posthog/ui/features/folders/useFolders";import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";import { DragBatchLabel } from "@posthog/ui/features/sidebar/components/DragBatchLabel";@@ -39,7 +40,13 @@ import {motion,useReducedMotion,} from "framer-motion";-import { Fragment, useCallback, useEffect, useMemo } from "react";+import {+ Fragment,+ type ReactNode,+ useCallback,+ useEffect,+ useMemo,+} from "react";interface TaskListViewProps {pinnedTasks: TaskData[];@@ -74,6 +81,58 @@ function SectionLabel({ label }: { label: string }) {return <MenuLabel className="flex items-center py-0">{label}</MenuLabel>;}+function FilingTaskAnimation({+ taskId,+ isDragged,+ prefersReducedMotion,+ children,+}: {+ taskId: string;+ isDragged: boolean;+ prefersReducedMotion: boolean;+ children: ReactNode;+}) {+ const filing = useFilingTasksStore((state) => state.filingTasks[taskId]);+ const hideFiledTask = useFilingTasksStore((state) => state.hideFiledTask);++ if (filing?.status === "hidden") return null;++ const rowTransition = prefersReducedMotion+ ? { duration: 0 }+ : {+ layout: { type: "spring" as const, stiffness: 520, damping: 42 },+ height: { duration: 0.16, ease: "easeOut" as const },+ opacity: { duration: 0.1 },+ };++ return (+ <motion.div+ layout={prefersReducedMotion ? false : "position"}+ layoutId={`sidebar-task-${taskId}`}+ initial={false}+ animate={+ isDragged || filing?.status === "complete"+ ? {+ height: 0,+ opacity: 0,+ scale: 0.98,+ x: filing?.status === "complete" ? -16 : 0,+ }+ : { height: "auto", opacity: 1, scale: 1 }+ }+ onAnimationComplete={() => {+ if (filing?.status === "complete") {+ hideFiledTask(taskId, filing.channelId);+ }+ }}+ transition={rowTransition}+ className="overflow-hidden"+ >+ {children}+ </motion.div>+ );+}+export function TaskListView({pinnedTasks,flatTasks,@@ -172,14 +231,6 @@ export function TaskListView({[],);- const rowTransition = prefersReducedMotion- ? { duration: 0 }- : {- layout: { type: "spring" as const, stiffness: 520, damping: 42 },- height: { duration: 0.16, ease: "easeOut" as const },- opacity: { duration: 0.1 },- };-const draggedIdSet = useMemo(() => new Set(dragState?.items.map((task) => task.id) ?? []),[dragState],@@ -188,18 +239,11 @@ export function TaskListView({const renderTaskRow = (task: TaskData, depth = 0) => {const isDragged = draggedIdSet.has(task.id);return (- <motion.div+ <FilingTaskAnimationkey={task.id}- layout={prefersReducedMotion ? false : "position"}- layoutId={`sidebar-task-${task.id}`}- initial={false}- animate={- isDragged- ? { height: 0, opacity: 0, scale: 0.98 }- : { height: "auto", opacity: 1, scale: 1 }- }- transition={rowTransition}- className="overflow-hidden"+ taskId={task.id}+ isDragged={isDragged}+ prefersReducedMotion={Boolean(prefersReducedMotion)}><TaskRowtask={task}@@ -228,7 +272,7 @@ export function TaskListView({)}depth={depth}/>- </motion.div>+ </FilingTaskAnimation>);};diff --git a/products/desktop/packages/ui/src/features/sidebar/components/TaskRow.tsx b/products/desktop/packages/ui/src/features/sidebar/components/TaskRow.tsxindex 5017850ae41d..cd28413d16e0 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/TaskRow.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/TaskRow.tsx@@ -1,4 +1,5 @@import type { TaskData } from "@posthog/core/sidebar/sidebarData.types";+import { useFilingTasksStore } from "@posthog/ui/features/canvas/stores/filingTasksStore";import { useArchivingTasksStore } from "@posthog/ui/features/sidebar/archivingTasksStore";import { TaskItem } from "@posthog/ui/features/sidebar/components/items/TaskItem";import { useTaskPrStatus } from "@posthog/ui/features/sidebar/useTaskPrStatus";@@ -70,6 +71,7 @@ export function TaskRow({? "progress": null,);+ const filing = useFilingTasksStore((state) => state.filingTasks[task.id]);if (archivePresentation === "hidden") return null;return (@@ -81,6 +83,7 @@ export function TaskRow({isActive={isActive}isSelected={isSelected}isArchiving={archivePresentation === "progress"}+ isFiling={filing?.status === "pending"}hideHoverActions={hideHoverActions}isEditing={isEditing}workspaceMode={effectiveMode}diff --git a/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.test.tsx b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.test.tsxindex 3482aa70f9f6..27623646415a 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.test.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.test.tsx@@ -34,39 +34,45 @@ describe("InlineEditInput", () => {});describe("TaskItem", () => {- it("renders inert archive progress instead of edit or pull request actions", () => {- const onClick = vi.fn();- const onDoubleClick = vi.fn();- const onContextMenu = vi.fn();- const { container } = render(- <TaskItem- taskId="task-1"- label="Archive me"- isActive={false}- isArchiving- isEditing- prUrl="https://github.com/PostHog/posthog/pull/123"- onClick={onClick}- onDoubleClick={onDoubleClick}- onContextMenu={onContextMenu}- />,- );+ it.each([+ ["archive", { isArchiving: true }, "Archiving"],+ ["filing", { isFiling: true }, "Filing"],+ ] as const)(+ "renders inert %s progress instead of edit or pull request actions",+ (_operation, progress, label) => {+ const onClick = vi.fn();+ const onDoubleClick = vi.fn();+ const onContextMenu = vi.fn();+ const { container } = render(+ <TaskItem+ taskId="task-1"+ label="Archive me"+ isActive={false}+ {...progress}+ isEditing+ prUrl="https://github.com/PostHog/posthog/pull/123"+ onClick={onClick}+ onDoubleClick={onDoubleClick}+ onContextMenu={onContextMenu}+ />,+ );- const row = screen.getByText("Archive me").closest("button");- expect(row).toHaveAttribute("aria-busy", "true");- expect(row).toHaveAttribute("aria-disabled", "true");- expect(screen.getByText("Archiving")).toHaveClass("sr-only");- expect(container.querySelector("[aria-hidden='true']")).not.toBeNull();- expect(screen.queryByRole("textbox")).toBeNull();- expect(screen.queryByLabelText("Open pull request #123")).toBeNull();+ const row = screen.getByText("Archive me").closest("button");+ expect(row).toHaveAttribute("aria-busy", "true");+ expect(row).toHaveAttribute("aria-disabled", "true");+ expect(screen.getByText(label)).toHaveClass("sr-only");+ expect(container.querySelector("[aria-hidden='true']")).not.toBeNull();+ expect(screen.queryByRole("textbox")).toBeNull();+ expect(screen.queryByLabelText("Open pull request #123")).toBeNull();- if (row) {- fireEvent.click(row);- fireEvent.doubleClick(row);- fireEvent.contextMenu(row);- }- expect(onClick).not.toHaveBeenCalled();- expect(onDoubleClick).not.toHaveBeenCalled();- expect(onContextMenu).not.toHaveBeenCalled();- });+ if (row) {+ fireEvent.click(row);+ fireEvent.doubleClick(row);+ fireEvent.contextMenu(row);+ }+ expect(onClick).not.toHaveBeenCalled();+ expect(onDoubleClick).not.toHaveBeenCalled();+ expect(onContextMenu).not.toHaveBeenCalled();+ },+ );});diff --git a/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.tsx b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.tsxindex 6a631c8a1e90..20f0c54b5bb9 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskItem.tsx@@ -10,6 +10,7 @@ import { navigateToPullRequestView } from "@posthog/ui/router/navigationBridge";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { DotsCircleSpinner } from "../../../../primitives/DotsCircleSpinner";import { NestedButton } from "../../../../primitives/NestedButton";+import { Spinner } from "../../../../primitives/Spinner";import { Tooltip } from "../../../../primitives/Tooltip";import type { SidebarPrState } from "../../useTaskPrStatus";import { SidebarItem } from "../SidebarItem";@@ -41,6 +42,7 @@ interface TaskItemProps {isSelected?: boolean;/** Archive request in flight: show a spinner and suppress hover actions. */isArchiving?: boolean;+ isFiling?: boolean;hideHoverActions?: boolean;workspaceMode?: WorkspaceMode;isGenerating?: boolean;@@ -117,6 +119,7 @@ export function TaskItem({isActive,isSelected = false,isArchiving = false,+ isFiling = false,hideHoverActions = false,workspaceMode,isSuspended = false,@@ -143,11 +146,17 @@ export function TaskItem({onEditSubmit,onEditCancel,}: TaskItemProps) {+ const isBusy = isArchiving || isFiling;const icon = isArchiving ? (<><DotsCircleSpinner size={ICON_SIZE} className="text-gray-10" /><span className="sr-only">Archiving</span></>+ ) : isFiling ? (+ <>+ <Spinner size="xs" label="Filing" className="text-gray-10" />+ <span className="sr-only">Filing</span>+ </>) : (<TaskIconworkspaceMode={workspaceMode}@@ -167,7 +176,7 @@ export function TaskItem({const prRef = useMemo(() => (prUrl ? parseGithubUrl(prUrl) : null), [prUrl]);const prBadge =- !isArchiving && prUrl && prRef?.kind === "pr" ? (+ !isBusy && prUrl && prRef?.kind === "pr" ? (<PrBadge url={prUrl} number={prRef.number} />) : null;@@ -180,7 +189,7 @@ export function TaskItem({) : null;const toolbar =- !isArchiving && !hideHoverActions && (onArchive || onTogglePin) ? (+ !isBusy && !hideHoverActions && (onArchive || onTogglePin) ? (<TaskHoverToolbarisPinned={isPinned}onTogglePin={onTogglePin}@@ -209,7 +218,7 @@ export function TaskItem({[onDragStart, taskId],);- if (isEditing && !isArchiving) {+ if (isEditing && !isBusy) {return (<InlineEditInputdepth={depth}@@ -230,17 +239,17 @@ export function TaskItem({subtitle={subtitle}isActive={isActive}isSelected={isSelected}- aria-busy={isArchiving || undefined}+ aria-busy={isBusy || undefined}// Lets a drag-selection find the row and the session it stands for.{...{ [SESSION_ROW_ATTRIBUTE]: taskId }}- isDimmed={isArchiving}- disabled={isArchiving}- draggable={!isArchiving}+ isDimmed={isBusy}+ disabled={isBusy}+ draggable={!isBusy}onDragStart={handleDragStart}onDragEnd={onDragEnd}- onClick={isArchiving ? undefined : onClick}- onDoubleClick={isArchiving ? undefined : onDoubleClick}- onContextMenu={isArchiving ? undefined : onContextMenu}+ onClick={isBusy ? undefined : onClick}+ onDoubleClick={isBusy ? undefined : onDoubleClick}+ onContextMenu={isBusy ? undefined : onContextMenu}endContent={endContent}/>);diff --git a/products/desktop/packages/ui/src/features/task-detail/components/TaskDetail.tsx b/products/desktop/packages/ui/src/features/task-detail/components/TaskDetail.tsxindex 117e192a75e3..f00c4b839558 100644--- a/products/desktop/packages/ui/src/features/task-detail/components/TaskDetail.tsx+++ b/products/desktop/packages/ui/src/features/task-detail/components/TaskDetail.tsx@@ -9,7 +9,9 @@ import { useArchiveShortcut } from "../../archive/useArchiveShortcut";import { useTaskArchive } from "../../archive/useTaskArchive";import { ChannelBreadcrumb } from "../../canvas/components/ChannelBreadcrumb";import { CopyThreadLinkButton } from "../../canvas/components/CopyThreadLinkButton";+import { useChannels } from "../../canvas/hooks/useChannels";import { useMarkTaskActivityRead } from "../../canvas/hooks/useMarkTaskActivityRead";+import { useFilingTasksStore } from "../../canvas/stores/filingTasksStore";import {LazyCloudReviewPage as CloudReviewPage,LazyReviewPage as ReviewPage,@@ -55,6 +57,11 @@ export function TaskDetail({}: TaskDetailProps) {const taskId = initialTask.id;const { task } = useTaskData({ taskId, initialTask });+ const { channels } = useChannels();+ const filing = useFilingTasksStore((state) => state.filingTasks[taskId]);+ const taskChannel = channels.find((channel) => channel.id === task.channel);+ const resolvedChannelId = task.channel ?? channelId;+ const resolvedChannelName = taskChannel?.name ?? channelName;useMarkTaskViewed(taskId);const effectiveRepoPath = useCwd(taskId);@@ -136,10 +143,10 @@ export function TaskDetail({// Memoized so the headerContent memo below isn't busted by unrelated renders.const trailing = useMemo(() =>- channelId ? (- <CopyThreadLinkButton channelId={channelId} taskId={taskId} />+ resolvedChannelId ? (+ <CopyThreadLinkButton channelId={resolvedChannelId} taskId={taskId} />) : null,- [channelId, taskId],+ [resolvedChannelId, taskId],);const workspace = useWorkspace(taskId);const workspaceMode = workspace?.mode;@@ -148,10 +155,11 @@ export function TaskDetail({// Inside a channel, prefix the editable title with the channel// breadcrumb ("# channel / title"); the plain Code view keeps the bare// title. Both share the same inline-rename editor.- channelName ? (+ resolvedChannelName ? (<ChannelBreadcrumb- channelName={channelName}- channelId={channelId}+ channelName={resolvedChannelName}+ channelId={resolvedChannelId}+ isLoading={filing?.status === "pending"}leafIcon={<span className="flex items-center gap-1.5"><TaskHeaderMark@@ -204,8 +212,9 @@ export function TaskDetail({</Flex>),[- channelName,- channelId,+ resolvedChannelName,+ resolvedChannelId,+ filing?.status,task,trailing,isEditingTitle,diff --git a/products/desktop/packages/ui/src/features/tasks/useTaskContextMenu.ts b/products/desktop/packages/ui/src/features/tasks/useTaskContextMenu.tsindex b3890d7811f2..ab8cbaa0d2cb 100644--- a/products/desktop/packages/ui/src/features/tasks/useTaskContextMenu.ts+++ b/products/desktop/packages/ui/src/features/tasks/useTaskContextMenu.ts@@ -7,13 +7,12 @@ import { PROJECT_BLUEBIRD_FLAG } from "@posthog/shared";import type { Task } from "@posthog/shared/domain-types";import { useArchiveTask } from "@posthog/ui/features/archive/useArchiveTask";import { useChannels } from "@posthog/ui/features/canvas/hooks/useChannels";-import { useChannelTaskMutations } from "@posthog/ui/features/canvas/hooks/useChannelTasks";+import { useFileTaskToChannel } from "@posthog/ui/features/canvas/hooks/useFileTaskToChannel";import { useExternalAppAction } from "@posthog/ui/features/external-apps/useExternalAppAction";import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";import { useRestoreTask } from "@posthog/ui/features/suspension/useRestoreTask";import { useSuspendTask } from "@posthog/ui/features/suspension/useSuspendTask";import { useDeleteTask } from "@posthog/ui/features/tasks/useTaskCrudMutations";-import { toast } from "@posthog/ui/primitives/toast";import { logger } from "@posthog/ui/shell/logger";import { useCallback, useState } from "react";@@ -34,7 +33,9 @@ export function useTaskContextMenu() {import.meta.env.DEV,);const { channels } = useChannels({ enabled: bluebirdEnabled });- const { fileTask } = useChannelTaskMutations();+ const fileTaskToChannel = useFileTaskToChannel({+ enabled: bluebirdEnabled,+ });const showContextMenu = useCallback(async (@@ -149,20 +150,7 @@ export function useTaskContextMenu() {await onHandoff?.();break;case "file-to-channel":- try {- await fileTask(intent.channelId, task.id);- const channelName = channels.find(- (channel) => channel.id === intent.channelId,- )?.name;- toast.success(- channelName ? `Filed to ${channelName}` : "Task filed",- );- } catch (error) {- toast.error("Couldn't file task", {- description:- error instanceof Error ? error.message : String(error),- });- }+ await fileTaskToChannel(intent.channelId, task.id, task.title);break;case "external-app": {const effectivePath = resolveExternalAppPath(@@ -188,7 +176,7 @@ export function useTaskContextMenu() {archiveTask,channels,deleteWithConfirm,- fileTask,+ fileTaskToChannel,restoreTask,suspendTask,hostClient,