docs: add .claude-done summary for rename-note-tab
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
35
.claude-done
Normal file
35
.claude-done
Normal file
@@ -0,0 +1,35 @@
|
||||
# Rename Note Tab — Done Summary
|
||||
|
||||
## What was built
|
||||
Double-click a tab title to rename the note. The tab shows an inline text input (Enter saves, Escape cancels). Renaming updates the note's title, filename, H1 heading, frontmatter `title:` field, and all wiki links (`[[OldName]]` → `[[NewName]]`) across the entire vault.
|
||||
|
||||
## Commits on `task/rename-note-tab`
|
||||
1. `caa26b6` — design: rename-note-tab wireframes (`design/rename-note-tab.pen`)
|
||||
2. `68dfab4` — feat: add `rename_note` Tauri command with wiki link updates (Rust backend)
|
||||
3. `5a8eb6a` — feat: rename note via double-click on tab — frontend wiring
|
||||
4. `ee00c2c` — test: Playwright e2e tests for rename tab feature
|
||||
|
||||
## Architecture decisions
|
||||
- **Slug generation**: title → lowercase, non-alphanumeric chars replaced with hyphens, leading/trailing hyphens stripped. Same logic in Rust backend and TypeScript mock.
|
||||
- **Wiki link matching**: regex matches both title-based (`[[Old Title]]`) and path-stem-based (`[[note/old-title]]`) references, preserving pipe aliases (`[[Old Title|display]]` → `[[New Title|display]]`).
|
||||
- **State flow**: `onRenameTab` flows from TabBar → Editor → App → `useNoteActions.handleRenameNote` → Tauri backend → `useVaultLoader.replaceEntry` (updates entries + allContent atomically).
|
||||
- **H1 + frontmatter**: The rename updates both the first `# Heading` line and the `title:` frontmatter field if present.
|
||||
- **Toast feedback**: Shows "Renamed" or "Renamed — updated N wiki links" on success, "Failed to rename note" on error.
|
||||
|
||||
## Code health
|
||||
- **TabBar.tsx**: Improved from CC 23→18 by extracting `TabItem` component and `tabStyle` helper.
|
||||
- **Rust `vault.rs`**: Passed code health after extracting helpers (`build_wikilink_pattern`, `WikilinkReplacement` struct, `collect_md_files`, etc.) to keep CC under thresholds.
|
||||
- **useNoteActions.ts**: Pre-existing CC=37 (threshold 9) increased to 42. Extracted `performRename` and `buildRenamedEntry` as module-level functions. Proper fix requires splitting the monolithic hook (separate concern).
|
||||
- **App.tsx / useVaultLoader.ts**: Minor LOC/CC increases on already-above-threshold functions.
|
||||
|
||||
## Test results
|
||||
- `pnpm test` — 119/119 passed
|
||||
- `cargo test` — 147/147 passed (including 7 new rename tests)
|
||||
- `npx vite build` — success
|
||||
- Playwright e2e — 2/2 rename-tab tests pass
|
||||
|
||||
## Visual verification
|
||||
Tested on `localhost:5173` via Playwright:
|
||||
- Double-click → inline input appears with current title selected
|
||||
- Type new name → Enter → tab title updates, note list updates, breadcrumb updates, toast shows "Renamed"
|
||||
- Double-click → type → Escape → title reverts, no changes made
|
||||
Reference in New Issue
Block a user