Skip to content

Fix note title autofill while editing - #769

Merged
hardbeat920 merged 1 commit into
hardbeat920:mainfrom
Umupa:fix/note-title-focused-draft
Oct 6, 2026
Merged

hardbeat920 merged 1 commit into
hardbeat920:mainfrom
Umupa:fix/note-title-focused-draft

Conversation

@Umupa

@Umupa Umupa commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Keep the note title draft intact while its input is focused, including empty titles and surrounding spaces. Autosave still writes non-empty titles and other note fields; the existing title fallback is committed on blur or editor teardown.

Why

Fixes #768. The 400 ms autosave normalized the title and cleared its local edit while the user was still typing. A save that starts during title editing now preserves the draft for the final queued save, including when the editor unmounts before the earlier request finishes.

UI

No layout changes. Verified in a native macOS app with an isolated Tauri identifier and SQLite database: clear and pause, type a replacement, clear a custom title, and blur to commit the generated fallback. Confirmed the saved title and body directly in SQLite.

Before

After clearing the title, autosave fills the focused input with the first line of the body.

Before fix: clearing the focused title refills it from the body

After

The cleared title draft stays empty while the input is focused. The grey Untitled is a placeholder, not a generated title.

After fix: cleared title stays empty while focused; Untitled is the placeholder

Validation

  • npm run check passed. Final npm run check:web: 4,265 passed, 13 existing skips. Rust: 539 passed, 1 existing ignored test.
  • Notes editor: 20 tests passed, including six new regression cases. Four new assertions fail on the original implementation.
  • Removing the save-start focus guard makes the pending-save/unmount regression fail; restoring it passes.
  • macOS app bundle built successfully. Native UI verification was performed on macOS only.

Checklist

  • I ran npm run check
  • This PR is small and focused
  • I did not mix unrelated changes

Summary by CodeRabbit

  • Bug Fixes
    • Note title edits now remain visible while the title field is focused, including when the draft is cleared or contains only spaces.
    • When focus leaves the title field, a cleared title falls back to the title derived from the note body. Pending title edits are also saved when the editor closes, including while a body save is completing.

Autosave normalized empty and spaced titles while the input was still focused, then cleared the local edit. Keep that draft until blur or editor teardown, while continuing to save body edits and non-empty titles. Cover delayed saves and unmounts with regression tests for hardbeat920#768.
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 15f48137-d500-4491-9c9d-46833f669ca9
📥 Commits

Reviewing files that changed from the base of the PR and between 98da85a and 6e4cde5.

📒 Files selected for processing (2)
  • src/features/notes/ui/NotesView.test.ts
  • src/features/notes/ui/NotesView.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The title editor now preserves blank or whitespace drafts while focused during saves. When focus leaves the input, the draft clears and the saved title can use the body-derived fallback. Tests cover autosaves, blur, refocus, and unmount.

Changes

Title draft handling

Layer / File(s) Summary
Focused title save and fallback behavior
src/features/notes/ui/NotesView.tsx, src/features/notes/ui/NotesView.test.ts
The editor tracks title input focus and retains blank or whitespace drafts during saves while focused. Tests cover fallback titles on blur and unmount, trimmed stored values, and delayed saves completing after refocus or unmount.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: hardbeat920

Merge Risk: ⚪ Minimal · up to 6e4cd

Clearing a note title no longer gets overwritten while the title field is focused, and the fallback title is applied on blur or when the editor closes. No merge-blocking risk is visible from the supplied evidence.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #768 requires an empty title to remain empty while its field is focused and the generated fallback to apply when editing ends. NotesView.tsx preserves the current title during a focused empty-…
Out of Scope Changes check ✅ Passed The diff changes only NotesView.tsx and its tests. The save behavior and regression tests directly support issue #768. No unrelated changes appear in the reviewed diff.
Title check ✅ Passed The title clearly summarizes the main change: preventing note-title autofill while the user edits the title.
Description check ✅ Passed The description covers the template’s What changed, Why, UI, and Checklist sections. It also provides validation details and marks all checklist items complete.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hardbeat920

Copy link
Copy Markdown
Owner

@Umupa looks good to me! thank you

@hardbeat920
hardbeat920 merged commit 7eebfc1 into hardbeat920:main Oct 6, 2026
10 checks passed
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.

[Bug]: Clearing a note title replaces it with body text while still editing

2 participants