mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 23:36:20 +00:00
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:
1 parent
fce7526fcf
commit
5e25db3e24
9 files changed
+102
-29
No files matched your search
@@ -27,6 +27,18 @@ class _ShellState extends State<Shell> {
|
||||
final app = AppScope.of(context);
|
||||
final colors = context.colors;
|
||||
final route = app.route;
|
||||
final error = app.writeError;
|
||||
if (error != null) {
|
||||
app.writeError = null;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Could not save a change; reloaded. ($error)'),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
return CallbackShortcuts(
|
||||
bindings: {
|
||||
const SingleActivator(LogicalKeyboardKey.keyK, control: true): () =>
|
||||
@@ -96,7 +108,7 @@ class _ShellState extends State<Shell> {
|
||||
),
|
||||
Expanded(
|
||||
child: KeyedSubtree(
|
||||
key: ValueKey(route),
|
||||
key: ValueKey((route, app.generation)),
|
||||
child: switch (route) {
|
||||
JournalsRoute() => const JournalsView(),
|
||||
TimelineRoute() => const TimelineView(),
|
||||
|
||||
Reference in new issue
Block a user