feat(ui): shared record-scoped useDocumentDraft hook; fix half-wired invoice draft banner; dedupe draft keys

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-09 16:24:22 +02:00
parent b4f1b6ce2b
commit c4668357aa
6 changed files with 219 additions and 100 deletions

View File

@@ -0,0 +1,12 @@
/**
* Single source of truth for the localStorage keys used by the document-draft
* autosave feature. Both the form (write side) and the list/banner (read side)
* MUST import the key from here — duplicating the string literal in two files
* means changing one silently breaks the other (the banner stops matching).
*/
export const DRAFT_KEYS = {
offer: "boha_offer_draft",
invoice: "boha_invoice_draft",
} as const;
export type DraftKey = (typeof DRAFT_KEYS)[keyof typeof DRAFT_KEYS];