Skip to content

Add /new create flow and two-intent delete - #7

Merged
unforced merged 1 commit into
mainfrom
create-delete
Apr 18, 2026
Merged

Add /new create flow and two-intent delete#7
unforced merged 1 commit into
mainfrom
create-delete

Conversation

@unforced

Copy link
Copy Markdown
Contributor

Summary

  • /new route: path (required), optional one-line metadata.summary, shared tag chip editor, CodeMirror content editor + live preview. On create → toast + navigate to /notes/<new-id> (read view, not editor).
  • Delete button on NoteView and NoteEditor opens a two-intent modal: must type the note's path exactly before the destructive button enables. Success → toast + navigate /notes, with the deleted note removed from cache and lists invalidated.
  • Minimal useToastStore + <Toaster /> portal for create/delete feedback (no library).
  • TagEditor extracted so /new and /edit share the chip input.
  • VaultClient.createNote / deleteNote and matching mutation hooks. 401 surfaces as VaultAuthError on both paths.
  • Home and /notes empty-state "Create one" now links to /new.

Scope calls

  • Duplicate-path: vault returns 500 with "Internal server error" (UNIQUE violation surfaces as a generic error), not a typed conflict — /new shows the server message with a hint "if the path is taken, try a different one." Cleaner duplicate handling is a vault-side change.
  • No undo-delete in v1, as scoped. Cache is invalidated after DELETE.
  • Delete uses the type-the-path gate rather than a second "Really delete" button — higher friction for an irreversible action.
  • Toaster uses native <output aria-live="polite"> and the confirm modal uses native <dialog open> to satisfy a11y lints; keeping the existing backdrop-click-to-close/Escape handlers.

Test plan

  • bun run typecheck — clean
  • bun run lint — clean
  • bun run test — 88 pass (14 files)
  • bun run build — clean
  • New tests cover: createNote/deleteNote client paths incl. 401, /new validation + happy POST + duplicate-path error preservation, delete modal gate (single click doesn't delete; Enter without match doesn't delete; happy DELETE + navigate + toast).

🤖 Generated with Claude Code

- /new route: path, optional summary, tag chip editor, CodeMirror content editor; POSTs to /api/notes and navigates to /notes/<new-id>
- Delete button on NoteView + NoteEditor: modal gate requires typing the note path before the destructive button enables
- Minimal toast store + Toaster for success/error feedback after create/delete
- TagEditor extracted so /new and /edit share the same chip input
- VaultClient gains createNote + deleteNote; useCreateNote/useDeleteNote invalidate notes/tags/vaultInfo and remove the deleted note's cache entry
- Home and /notes empty-state "Create one" now links to /new

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@unforced
unforced merged commit bd52644 into main Apr 18, 2026
@unforced
unforced deleted the create-delete branch April 18, 2026 21:44
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.

1 participant