Skip to content

Fix: overwrite note content on switching - #362

Draft
7eliassen wants to merge 9 commits into
fix/editor-block-displayingfrom
fix/notes-switching-content-overwrite
Draft

Fix: overwrite note content on switching#362
7eliassen wants to merge 9 commits into
fix/editor-block-displayingfrom
fix/notes-switching-content-overwrite

Conversation

@7eliassen

@7eliassen 7eliassen commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

When switching between notes, the previously opened note's content could be applied to the newly opened note. Two root causes:

  1. The previous note's editor stayed mounted while the new note loaded, so its handlers remained alive and could write the old content into the new note.
  2. An in-flight 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. useNoteEditor now watches noteId and resets isEditorReady on every change. Since the <Editor> is rendered with v-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 to save(), 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.tssave() 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-unneeded isNoteSaving flag and the related draft-save skip logic.
  • useNoteEditor.ts — added a noteId option 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.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codex-ui Ready Ready Preview Aug 11, 2026 12:23pm

@codex-assistant

Copy link
Copy Markdown

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.

@7eliassen 7eliassen linked an issue Aug 11, 2026 that may be closed by this pull request
@codex-assistant
codex-assistant Bot marked this pull request as ready for review August 11, 2026 12:22
@codex-assistant

Copy link
Copy Markdown

Thanks for adding a description — the PR is now marked as Ready for Review.

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: Note content may be overwritten

1 participant