Notechondria

Version: 0.1.24 Build Date: 2026-04-18T01:00

What's Changed

Editor — note-view local-category delete + pull-then-merge on login

  • Local-category delete when logged out was already functionally correct — _deleteCategory handled local courses at lines 1762-1799 (reassigns drafts to the local default Inbox, removes the course from _localCourses, persists). No auth gate blocked this for local courses; is_default == true (Inbox) was already the only guard. No code change was required for this part.

  • Pull-then-merge on login was already the _applyAuthPayload flow: _loadInitialData() (pulls remote) followed by _syncAllLocalData() (pushes remaining local courses/drafts, re-pulls). No code change was required for the high-level flow.

  • Bug fix: draft orphan on local-Inbox-to-remote-Inbox swap. When _loadInitialData detected that the server has a default (Inbox) category, it dropped the local default from _localCourses but did NOT remap drafts that pointed at the local Inbox's negative ID. Those drafts would subsequently be synced with the stale negative course_id, which the server would silently ignore or reject.

    Fixed by extending the "drop local default" block in _loadInitialData to also iterate _localDrafts and call _remapDraftCourseId(draft, localDefaultId, remoteDefaultId) for every draft whose course_id matches the old local Inbox. Both _localDrafts and _localCourses are persisted in the same pass so state stays consistent.

Files Changed

Modified

  • frontend/editor_app/lib/app_shell.dart_loadInitialData: extended the remote-default-replaces-local-default block to remap orphaned drafts before persisting.
  • VERSION — 0.1.23 -> 0.1.24.
  • docs/TODO.md — "Allow user to delete local category" item removed.
  • docs/versions/0.1.24.md (this file).

Verification

  • flutter analyze on editor_app — 33 issues, all pre-existing (same count as 0.1.23).
  • flutter test test/smoke_test.dart -r compact — passes.

Notes / follow-ups

  • Planner and portal do not expose category delete yet; this change is editor-only.
  • The 0.1.20 invalid-token session-clear + bind-without-token short-circuit still need replicating into planner / portal app_shell.dart (pre-existing bug from docs/TODO.md).