Files
fusion/packages/dashboard/app/hooks/useTaskHandlers.ts
gsxdsm cf3fe8b485 FN-7591: make dashboard create surfaces resolve intake column from workflow instead of hard-coding triage
Fixes dashboard task creation so new cards land in the selected/default workflow's intake column instead of always forcing legacy triage, letting workflows like Coding (Ideas) park new cards in 'ideas' until an operator promotes them.

- InlineCreateCard, QuickEntryBox, and NewTaskModal no longer hard-code column:"triage"; InlineCreateCard now forwards workflowId at create time instead of applying it post-create.
- Fixed a glue-layer regression in useTaskHandlers.ts (handleBoardQuickCreate/handleModalCreate) that re-forced column:"triage" even after UI surfaces stopped sending it.
- Added/updated tests covering the store's intake-column resolution and the dashboard create surfaces/hooks.
- Documented the new manual-intake-column parking behavior in dashboard-guide.md and workflow-steps.md.
- Added a patch changeset for @runfusion/fusion.

Files changed:
 .changeset/fn-7591-coding-ideas-intake.md          |  7 +++
 docs/dashboard-guide.md                            |  4 ++
 docs/workflow-steps.md                             |  1 +
 packages/core/src/__tests__/store-create-intake-column.test.ts   | 20 ++++++++
 packages/dashboard/app/App.tsx                     |  5 +-
 packages/dashboard/app/components/InlineCreateCard.tsx  | 28 ++++------
 packages/dashboard/app/components/NewTaskModal.tsx |  5 +-
 packages/dashboard/app/components/QuickEntryBox.tsx     |  5 +-
 packages/dashboard/app/components/TodoView.tsx     |  7 ++-
 packages/dashboard/app/components/__tests__/InlineCreateCard.test.tsx | 59 +++++++++++++++++++++-
 packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx    | 14 +++--
 packages/dashboard/app/components/__tests__/TodoView.test.tsx | 10 ++--
 packages/dashboard/app/components/__tests__/board-quickcreate-workflow-lane-visibility.test.tsx | 45 ++++++++++++++++-
 packages/dashboard/app/hooks/__tests__/useTaskHandlers.test.ts    | 27 ++++++++--
 packages/dashboard/app/hooks/useTaskHandlers.ts    |  8 ++-
 15 files changed, 207 insertions(+), 38 deletions(-)

Fusion-Task-Id: FN-7591

Fusion-Task-Lineage: 510f0e6a-89e7-468f-a6df-ad6aebd5c33a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-05 13:15:56 -07:00

82 lines
3.3 KiB
TypeScript

import { useCallback } from "react";
import { useTranslation } from "react-i18next";
import type { Task, TaskCreateInput } from "@fusion/core";
import type { ToastType } from "./useToast";
interface UseTaskHandlersOptions {
createTask: (input: TaskCreateInput) => Promise<Task>;
ingestCreatedTasks: (tasks: Task[]) => void;
onPlanningTaskCreated: (task: Task, addToast: (msg: string, type?: ToastType) => void) => void;
onPlanningTasksCreated: (tasks: Task[], addToast: (msg: string, type?: ToastType) => void) => void;
onSubtaskTasksCreated: (tasks: Task[], addToast: (msg: string, type?: ToastType) => void) => void;
addToast: (message: string, type?: ToastType) => void;
}
export interface UseTaskHandlersResult {
handleBoardQuickCreate: (input: TaskCreateInput) => Promise<Task>;
handleModalCreate: (input: TaskCreateInput) => Promise<Task>;
handlePlanningTaskCreated: (task: Task) => void;
handlePlanningTasksCreated: (tasks: Task[]) => void;
handleSubtaskTasksCreated: (tasks: Task[]) => void;
handleGitHubImport: (task: Task) => void;
}
export function useTaskHandlers(options: UseTaskHandlersOptions): UseTaskHandlersResult {
const { t } = useTranslation("app");
const {
createTask,
ingestCreatedTasks,
onPlanningTaskCreated,
onPlanningTasksCreated,
onSubtaskTasksCreated,
addToast,
} = options;
/*
FNXC:CodingIdeasWorkflow 2026-07-05-00:00:
These wrappers previously forced `column: "triage"` (handleBoardQuickCreate defaulted to it when the caller omitted column; handleModalCreate hard-coded it unconditionally), which overrode InlineCreateCard/NewTaskModal even after those callers stopped sending an explicit column. Both must now forward the caller's `column` untouched (usually omitted) so the store resolves the landing column from the (selected or default) workflow's intake column — e.g. Coding (Ideas) → "ideas" — instead of always forcing legacy triage.
*/
const handleBoardQuickCreate = useCallback(
async (input: TaskCreateInput): Promise<Task> => {
return createTask({ ...input, source: { sourceType: "dashboard_ui" } });
},
[createTask],
);
const handleModalCreate = useCallback(
async (input: TaskCreateInput): Promise<Task> => {
const task = await createTask({ ...input, source: { sourceType: "dashboard_ui" } });
return task;
},
[createTask],
);
const handlePlanningTaskCreated = useCallback((task: Task) => {
ingestCreatedTasks([task]);
onPlanningTaskCreated(task, addToast);
}, [addToast, ingestCreatedTasks, onPlanningTaskCreated]);
const handlePlanningTasksCreated = useCallback((tasks: Task[]) => {
ingestCreatedTasks(tasks);
onPlanningTasksCreated(tasks, addToast);
}, [addToast, ingestCreatedTasks, onPlanningTasksCreated]);
const handleSubtaskTasksCreated = useCallback((tasks: Task[]) => {
ingestCreatedTasks(tasks);
onSubtaskTasksCreated(tasks, addToast);
}, [addToast, ingestCreatedTasks, onSubtaskTasksCreated]);
const handleGitHubImport = useCallback((task: Task) => {
addToast(t("taskHandlers.githubImported", "Imported {{id}} from GitHub", { id: task.id }), "success");
}, [addToast, t]);
return {
handleBoardQuickCreate,
handleModalCreate,
handlePlanningTaskCreated,
handlePlanningTasksCreated,
handleSubtaskTasksCreated,
handleGitHubImport,
};
}