todo-app/lib/ui
Krzysztof kuhy Rudnicki 01411810da Cut per-keystroke O(N) work to keep capture smooth at scale
The capture screen fed the on-disk BACKLOG.md backup off an always-live
watchNotes() subscription, so every keystroke re-queried the whole table,
re-parsed every row, and rebuilt the full Markdown export on the UI
isolate — O(notes) per character. It also fired a whole-screen setState
just to update the "Saved locally" timestamp.

- Add NoteRepository.changes: an O(1) broadcast tick after each write
  (upsert/delete/merge; importNotes transitively). LocalBackup now pulls
  notes via an injected fetcher only when its 2s debounce fires, so the
  query + parse + Markdown export runs at most once per idle window
  instead of on every keystroke. Capture listens to changes, not
  watchNotes; a launch-time schedule() keeps BACKLOG.md fresh.
- Scope the save indicator to a ValueNotifier/ValueListenableBuilder so a
  keystroke updates one line of text, not the AppBar/dropdowns/editor.
- Key list tiles by note id for identity-based reorder diffing.

Measured on a 4K/144Hz desktop the UI-thread build stays <=3.3ms;
coverage held at 100% on all changed files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:51:46 +02:00
..
capture_screen.dart Cut per-keystroke O(N) work to keep capture smooth at scale 2026-07-11 21:51:46 +02:00
markdown_view.dart Add full note view/editor with templates and Markdown render 2026-06-15 21:59:31 +02:00
note_detail_screen.dart Add priority/template wizard and raw-as-default for guided mode 2026-06-27 12:10:21 +02:00
note_editor.dart Fix guided mode: full-screen TextField and hide Save FAB 2026-06-27 17:32:50 +02:00
notes_list_screen.dart Cut per-keystroke O(N) work to keep capture smooth at scale 2026-07-11 21:51:46 +02:00
settings_screen.dart Point notes sync at the consolidated syncs monorepo 2026-07-10 14:04:05 +02:00