NewWacht Bench is live — AI-assisted development for Wacht

useProjectTaskBoardItem() hook

useProjectTaskBoardItem() is the detail hook for one task board item. It combines the item record, journal events, assignments, and workspace listing so a task detail screen can stay on one hook instead of composing those pieces manually.

Usage

The following example shows a basic usage of useProjectTaskBoardItem().

import { useProjectTaskBoardItem } from '@wacht/nextjs';export default function TaskDetail({  projectId,  itemId,}: {  projectId: string;  itemId: string;}) {  const { item, appendJournal, taskWorkspace } = useProjectTaskBoardItem(    projectId,    itemId,    true,  );  return (    <div>      <h1>{item?.title}</h1>      <p>{taskWorkspace.files.length} workspace entries</p>      <button        onClick={async () => {          await appendJournal({            summary: 'Reviewed task output',          });        }}      >        Add journal entry      </button>    </div>  );}

Return value

The hook returns the following fields and methods.

item?: ProjectTaskBoardItem | null | undefined;
The task board item itself.
events?: ProjectTaskBoardItemEvent[] | undefined;
Flattened task journal and event feed.
assignments?: ProjectTaskBoardItemAssignment[] | undefined;
Flattened assignment list for the task.
taskWorkspace?: ProjectTaskWorkspaceListing | undefined;
Current task workspace listing.
updateItem?: (request: UpdateProjectTaskBoardItemRequest, files?: File[]) => Promise<ApiResult<ProjectTaskBoardItem>> | undefined;
Updates the item and returns the updated item on `result.data`.
appendJournal?: (request: AppendProjectTaskBoardItemJournalRequest, files?: File[]) => Promise<ApiResult<ProjectTaskBoardItemEvent>> | undefined;
Appends a journal entry and returns the new event on `result.data`.
getTaskWorkspaceFile?: (path: string) => Promise<ApiResult<ProjectTaskWorkspaceFileContent>> | undefined;
Reads one workspace file. The file payload is available on `result.data`.

Overview

This hook is intentionally broad because the task detail screen itself is broad. It keeps the core task item, the task journal, the assignments, and the workspace listing in sync, and it revalidates the related pieces after mutations such as update or journal append.

On this page