MCPcopy Create free account
hub / github.com/TanStack/ai / touchThread

Function touchThread

examples/ts-react-chat/src/routes/threads.tsx:209–224  ·  view source on GitHub ↗
(id: string, title?: string)

Source from the content-addressed store, hash-verified

207
208 /** Bump recency, and set the title the first time a thread gets one. */
209 const touchThread = (id: string, title?: string) => {
210 commit(
211 threadsRef.current.map((t) =>
212 t.id === id
213 ? {
214 ...t,
215 updatedAt: Date.now(),
216 title:
217 title && t.title === NEW_CHAT_TITLE
218 ? truncateTitle(title)
219 : t.title,
220 }
221 : t,
222 ),
223 )
224 }
225
226 return { threads, loaded, createThread, deleteThread, touchThread }
227}

Callers 1

ThreadsRouteFunction · 0.85

Calls 3

commitFunction · 0.85
truncateTitleFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected