MCPcopy
hub / github.com/21st-dev/1code / buildDraftsCache

Function buildDraftsCache

src/renderer/features/agents/lib/drafts.ts:218–227  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

216
217// Build drafts cache from localStorage (for sidebar display)
218export function buildDraftsCache(): Record<string, string> {
219 const globalDrafts = loadGlobalDrafts()
220 const cache: Record<string, string> = {}
221 for (const [key, value] of Object.entries(globalDrafts)) {
222 if ((value as DraftContent)?.text) {
223 cache[key] = (value as DraftContent).text
224 }
225 }
226 return cache
227}
228
229/**
230 * Hook to get new chat drafts with automatic updates

Callers 2

useSubChatDraftsCacheFunction · 0.85
handleChangeFunction · 0.85

Calls 1

loadGlobalDraftsFunction · 0.85

Tested by

no test coverage detected