MCPcopy Create free account
hub / github.com/codeaashu/claude-code / useConversation

Function useConversation

web/hooks/useConversation.ts:3–15  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

1import { useChatStore } from "@/lib/store";
2
3export function useConversation(id: string) {
4 const { conversations, addMessage, updateMessage, deleteConversation } = useChatStore();
5 const conversation = conversations.find((c) => c.id === id) ?? null;
6
7 return {
8 conversation,
9 messages: conversation?.messages ?? [],
10 addMessage: (msg: Parameters<typeof addMessage>[1]) => addMessage(id, msg),
11 updateMessage: (msgId: string, updates: Parameters<typeof updateMessage>[2]) =>
12 updateMessage(id, msgId, updates),
13 deleteConversation: () => deleteConversation(id),
14 };
15}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected