Skip to content

Note editor: navigating away via the sidebar, Cmd-K or a deep link discards an unsaved draft #447

Description

@Optic00

Follow-up from #446, which makes a generated note editable. Recorded there as a known gap rather than fixed, because the right fix is router-level and did not belong in that PR.

What happens

Open a note, click Edit, type something, then leave the screen without saving:

Why it is worth fixing rather than documenting

The adjacent "My notes" tab autosaves. The app has already taught users that typing in a note persists, so losing an editor draft to a sidebar click is a broken expectation rather than a missing convenience.

Why it is not dangerous today

DetailContent is keyed on the summary file, so leaving and returning is a clean remount. The failure mode is therefore always a lost draft, never a draft applied to the wrong note. That is the correct fail-safe direction and is why this was acceptable to defer.

Suggested fix

A router-level unsaved-changes hook, so any navigation away from a route that declares itself dirty routes through the same ConfirmDialog the back arrow already uses. The editor already lifts its dirty state to MeetingDetail via onDirtyChange, so the state a hook would need is in place.

Guarding each navigation surface individually is the wrong shape: #446 already showed what that costs. The editing flag had to be threaded into six separate disabled expressions there, and two of them were missed and only caught by a whole-branch review.

Out of scope

Draft persistence (surviving a quit and relaunch) is a different and larger feature. This issue is only about being asked before the draft is discarded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions