(chatId: string, subChatId: string)
| 198 | |
| 199 | // Clear sub-chat draft (also revokes any blob URLs) |
| 200 | export 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) |
| 218 | export function buildDraftsCache(): Record<string, string> { |
no test coverage detected