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

Function writeIndex

examples/ts-react-chat/src/routes/threads.tsx:134–142  ·  view source on GitHub ↗
(threads: Array<ThreadMeta>)

Source from the content-addressed store, hash-verified

132}
133
134function writeIndex(threads: Array<ThreadMeta>): void {
135 if (!hasWindow()) return
136 try {
137 window.localStorage.setItem(INDEX_KEY, JSON.stringify(threads))
138 } catch {
139 // Best-effort, mirroring the persistence adapter: a full or unavailable
140 // store should never break the chat.
141 }
142}
143
144const byRecency = (a: ThreadMeta, b: ThreadMeta) => b.updatedAt - a.updatedAt
145

Callers 1

commitFunction · 0.85

Calls 1

hasWindowFunction · 0.85

Tested by

no test coverage detected