NewWacht Bench is live — AI-assisted development for Wacht

useProjectThreadFeed() hook

useProjectThreadFeed() is the infinite-list thread feed hook. It returns a flattened thread list together with loadMore() and the archive/query controls that a project sidebar usually needs.

Usage

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

import { useProjectThreadFeed } from '@wacht/nextjs';export default function ThreadFeed({  projectId,}: {  projectId: string;}) {  const { threads, hasMore, loadMore } = useProjectThreadFeed(projectId, {    query: '',  });  return (    <div>      <ul>        {threads.map((thread) => (          <li key={thread.id}>{thread.title}</li>        ))}      </ul>      {hasMore ? <button onClick={() => void loadMore()}>Load more</button> : null}    </div>  );}

Return value

The hook returns the following fields and methods.

threads?: AgentThread[] | undefined;
Flattened thread feed across the currently loaded pages.
hasMore?: boolean | undefined;
Whether another page can be loaded.
loadingMore?: boolean | undefined;
Whether the next page is currently loading.
loadMore?: () => Promise<void> | undefined;
Loads the next page when `hasMore` is true.

Overview

The feed hook is the one that matches a sidebar or other infinite scroll surface. It can include archived threads, restrict the feed to archived threads only, or filter the returned feed with a free-text query.

On this page