Skip to content

fix(editor): ignore markdown normalization in dirty state - #63

Merged
gnacho merged 1 commit into
mainfrom
fix/62-untouched-note-dirty
Nov 12, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/62-untouched-note-dirty

Conversation

@gnacho

@gnacho gnacho commented Nov 12, 2026

Copy link
Copy Markdown
Owner

The host editor 9.1 round-trips markdown through @tiptap/markdown. Opening a note can change its serialized form without any user edit: for example ~12 km becomes \~12 km and an extra trailing newline is added. The dirty guard compared that output with the raw markdown received from the Notes API, so every untouched note was reported as unsaved and switching notes opened the confirmation dialog.

This captures the editor output after loading a note as the clean baseline. Dirty checks, save decisions and reset/discard now compare against that baseline instead of the stored raw content.

Verification:

  • npm test: 4 tests passed, including a regression case where stored and serialized markdown differ but the note is clean.
  • npm run check:types: exit 0.
  • npm run build: exit 0.
  • Production repro before the fix: opening a note and clicking another showed Unsaved changes consistently.
  • CI now runs the extension tests.

Closes #62

The host editor round-trips markdown through its own serializer. Escaping such as ~ to \~ and trailing newlines can change the text without a user edit, so comparing against the stored markdown reported untouched notes as unsaved.

Capture the editor output after loading as the clean baseline and compare dirty checks, saves and resets against it. Add unit coverage for the baseline and run the extension tests in CI.

Closes #62
@gnacho

gnacho commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Tested the branch build on the live instance with an isolated account:

  • Open a note untouched, then select another: 0 dialogs and the selection changes.
  • Edit the title, then select another: 1 unsaved-changes dialog.
  • Discard: dialog closes, the selection changes and the original title is restored.

Unit tests 4/4, typecheck and build pass. The branch build is deployed for the maintainer visual check before merge.

@gnacho
gnacho merged commit c76ebfe into main Nov 12, 2026
4 checks passed
@gnacho
gnacho deleted the fix/62-untouched-note-dirty branch November 12, 2026 18:09
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.

Untouched notes are reported as unsaved when switching

1 participant