Skip to content

fix: prevent linked notes from being overwritten with old state#17

Merged
VariableThe merged 2 commits into
mainfrom
fix/internal-link-overwrite
Jun 22, 2026
Merged

fix: prevent linked notes from being overwritten with old state#17
VariableThe merged 2 commits into
mainfrom
fix/internal-link-overwrite

Conversation

@VariableThe

@VariableThe VariableThe commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Fixes a bug where opening a new note via an internal link, the search bar, or back navigation would cause the newly opened note to be overwritten by the contents of the previous note.

Added a key prop tied to activeNote.id to the CodeMirror component to ensure it fully remounts when changing notes, discarding stale state.

Summary by CodeRabbit

  • Documentation

    • Added project philosophy document outlining design principles, engineering practices, and core development values
    • Updated README with introductory section explaining the project's mission and commitment to performance, privacy, and user autonomy
  • Bug Fixes

    • Fixed editor state to properly reset when switching between notes, ensuring clean state transitions across editing sessions

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2dd652e-b959-41cd-8ead-5ecbed931cda

📥 Commits

Reviewing files that changed from the base of the PR and between b1883cc and 2d3e148.

📒 Files selected for processing (3)
  • PHILOSOPHY.md
  • README.md
  • src/components/Editor.tsx

📝 Walkthrough

Walkthrough

Adds PHILOSOPHY.md documenting the project's eight guiding principles and a closing statement. Updates README.md with a blockquote intro linking to that philosophy. Separately, adds key={activeNote.id} to the CodeMirror component in Editor.tsx so the editor remounts on note switches.

Changes

Project Philosophy Documentation

Layer / File(s) Summary
Philosophy document and README intro
PHILOSOPHY.md, README.md
Creates PHILOSOPHY.md with eight named principles (ephemeral scratchpad intent, active note-taking, zero-friction performance, developer workflows, open-source ethics, inline AI with encrypted keys, opinionated design, engineering rigor) plus a closing statement. Adds a blockquote in README.md after the main tagline that summarizes the stance and links to the new document.

Editor Remount on Note Switch

Layer / File(s) Summary
CodeMirror keyed by active note ID
src/components/Editor.tsx
Adds key={activeNote.id} to the CodeMirror element so React destroys and recreates the editor instance whenever the active note's ID changes, preventing state from one note persisting into another.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny hops between each note,
No stale state left to bloat,
Philosophy penned with care,
Eight principles fresh as morning air,
One tiny key, worlds apart! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main bug fix (preventing linked notes from being overwritten) which is the primary objective of this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/internal-link-overwrite

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 and usage tips.

@VariableThe VariableThe merged commit ca42baa into main Jun 22, 2026
4 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.

1 participant