MCPcopy Index your code
hub / github.com/21st-dev/1code / clearSubChatDraft

Function clearSubChatDraft

src/renderer/features/agents/lib/drafts.ts:200–215  ·  view source on GitHub ↗
(chatId: string, subChatId: string)

Source from the content-addressed store, hash-verified

198
199// Clear sub-chat draft (also revokes any blob URLs)
200export function clearSubChatDraft(chatId: string, subChatId: string): void {
201 const globalDrafts = loadGlobalDrafts()
202 const key = getSubChatDraftKey(chatId, subChatId)
203 const draft = globalDrafts[key] as DraftContent | undefined
204
205 // Revoke blob URLs for images and files before deleting
206 if (draft?.images) {
207 draft.images.forEach((img) => revokeDraftBlobUrls(img.id))
208 }
209 if (draft?.files) {
210 draft.files.forEach((file) => revokeDraftBlobUrls(file.id))
211 }
212
213 delete globalDrafts[key]
214 saveGlobalDrafts(globalDrafts)
215}
216
217// Build drafts cache from localStorage (for sidebar display)
218export function buildDraftsCache(): Record<string, string> {

Callers 2

active-chat.tsxFile · 0.90

Calls 4

loadGlobalDraftsFunction · 0.85
getSubChatDraftKeyFunction · 0.85
revokeDraftBlobUrlsFunction · 0.85
saveGlobalDraftsFunction · 0.85

Tested by

no test coverage detected