Add multi-draft management and draft expiry to useDraftPersistence#1191
Open
greatest0fallt1me wants to merge 1 commit into
Open
Add multi-draft management and draft expiry to useDraftPersistence#1191greatest0fallt1me wants to merge 1 commit into
greatest0fallt1me wants to merge 1 commit into
Conversation
- Replace single-draft storage with a named DraftMap keyed by id - Add 7-day TTL; expired drafts pruned on load via pruneExpiredDrafts - Backwards-compatible migration from legacy commitlabs-create-draft key - Expose allDrafts (sorted), clearAllDrafts, and per-id saveDraft/clearDraft/resumeDraft - Update ResumeDraftPrompt to list all available drafts with resume/delete actions - Add useDraftMultiExpiry.test.ts covering all edge cases (multi-draft, expiry, migration, invalid) - Add docs/DRAFT_MANAGEMENT.md with API, types, accessibility notes, and usage example Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@greatest0fallt1me is attempting to deploy a commit to the 1nonly's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #954
Summary
DraftMapkeyed byid, allowing multiple in-progress drafts simultaneouslypruneExpiredDrafts; stale drafts never resurfacecommitlabs-create-draftsingle-draft key (migrated silently on first load, old key removed)ResumeDraftPromptto list all available drafts with per-draft Resume and Delete actions, accessiblerole="dialog"markup, and focus ringsChanges
src/hooks/useDraftPersistence.ts— multi-draft + TTL + migration; exportspruneExpiredDrafts,migrateLegacyDraft,loadDraftsFromStorage,DRAFT_TTL_MS,NamedDraft,DraftMapsrc/components/create/ResumeDraftPrompt.tsx— updated props todrafts: NamedDraft[]withonResume(id)/onDeleteDraft(id)callbacks; shows relative timestampssrc/hooks/useDraftMultiExpiry.test.ts— new focused test file covering: multiple drafts persisted, expired draft pruned, legacy single-draft migrated, invalid draft rejected, sort order, clearAllDraftsdocs/DRAFT_MANAGEMENT.md— feature docs with API reference, types, accessibility notes, and usage example; cross-links existing autosave doc