(id: string, title?: string)
| 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 | } |
no test coverage detected