Skip to content

fix(create): make draft clearing reversible#455

Open
iccccccccccccc wants to merge 1 commit into
ChaoLing140:masterfrom
iccccccccccccc:fix-policy-draft-undo
Open

fix(create): make draft clearing reversible#455
iccccccccccccc wants to merge 1 commit into
ChaoLing140:masterfrom
iccccccccccccc:fix-policy-draft-undo

Conversation

@iccccccccccccc

@iccccccccccccc iccccccccccccc commented May 30, 2026

Copy link
Copy Markdown

Closes #428

What changed

  • keep the existing autosaved policy draft restore flow intact after the latest master changes
  • make explicit draft clearing reversible through the shared policy draft autosave hook
  • prevent the restore path from treating a freshly cleared draft backup as stale just because the saved draft timestamp is older than the clear action
  • add a focused page test around discard, undo, and saving the restored draft back to localStorage

Verification

  • pnpm exec vitest run src/app/create/create-page-client.test.tsx src/hooks/use-autosave.test.ts
  • pnpm exec next lint --file src/app/create/create-page-client.tsx --file src/app/create/create-page-client.test.tsx --file src/hooks/use-autosave.ts
  • git diff --check

Note: lint exits cleanly, with the existing react-hooks/exhaustive-deps warning in create-page-client.tsx still reported.

@iccccccccccccc iccccccccccccc force-pushed the fix-policy-draft-undo branch from 5765765 to a0ea7a3 Compare May 31, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist policy creation drafts across refresh

1 participant