Fix: overwrite note content on switching - #362
Draft
7eliassen wants to merge 9 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Please add a PR description 🙂Respect the reviewers — a description helps others understand the changes and review them faster. Keep it short, clear, and to the point. It also serves as documentation for future reference. The PR was moved to Draft until a description is added. |
|
Thanks for adding a description — the PR is now marked as Ready for Review. |
7eliassen
marked this pull request as draft
August 11, 2026 12:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When switching between notes, the previously opened note's content could be applied to the newly opened note. Two root causes:
save()used the id of the currently open note at completion time, so it wrote the old content into whatever note was open then.Solution
1-st Fix: destroy the old editor on note change.
useNoteEditornow watchesnoteIdand resetsisEditorReadyon every change. Since the<Editor>is rendered withv-if="isEditorReady", the previous editor is unmounted/destroyed and a fresh one is mounted only after the new note's data and tools are ready. A live old editor can no longer save into the new note.2-nd Fix: bind each save to the note it was started for.
noteChanged()captures the note id at save start and passes it tosave(), so an in-flight save always targets the correct note. Cached content (lastUpdateContent) and the note cover are only updated when the current note still matches the saved note, preventing stale data from leaking between notes.Key changes
useNote.ts—save()now takes the captured note id and uses it for the update; cached content is only stored when the current note hasn't changed. Removed the now-unneededisNoteSavingflag and the related draft-save skip logic.useNoteEditor.ts— added anoteIdoption and reset the editor state when the note changes.Note.vue— captures the note id at save time and passes it through; the cover is only updated when the captured id still matches the current note.