fix(app): read views after queued writes, reload on write failure

- Page and journal views read through the write queue after the previous
  view's pending saves, so they never load stale text.
- A failed write reloads the current view and shows a message instead of
  leaving blocks on temporary ids; inserts also trigger reconciliation.
- Completion replaces the query range, not up to the caret, and closes
  when the caret moves away.
- Renaming a page reloads it so rewritten links are not overwritten.
- Dropping below an expanded parent lands as its first child, where the
  indicator is drawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-21 04:08:36 +02:00
1 parent fce7526fcf
commit 5e25db3e24
9 files changed
+102 -29

No files matched your search

+7 -2
View File
@@ -298,6 +298,7 @@ class OutlineController extends ChangeNotifier {
if (wasFocused) focusedId = b.id;
if (!_disposed) notifyListeners();
});
_scheduleVerify();
}
void _refocus(OutlineNode n, int? caret) {
@@ -308,11 +309,15 @@ class OutlineController extends ChangeNotifier {
}
void _structural(Future<List<BlockDto>> Function() op) {
_structuralEdits++;
final seen = _structuralEdits;
_enqueue(() async {
await op();
});
_scheduleVerify();
}
void _scheduleVerify() {
_structuralEdits++;
final seen = _structuralEdits;
_reconcile?.cancel();
_reconcile = Timer(const Duration(milliseconds: 600), () {
if (seen == _structuralEdits) _verify();