fix: resolve navigation-cache regressions and todo UX

This commit is contained in:
qzl
2026-03-20 16:45:08 +08:00
parent 3f1858d733
commit 55f3805ee9
15 changed files with 160 additions and 105 deletions
@@ -46,11 +46,7 @@ class TodoRepository {
);
if (cached != null) {
final next = cached.value
.map(
(todo) => todo.id == id
? todo.copyWith(status: 'completed', completedAt: now())
: todo,
)
.where((todo) => todo.id != id)
.toList(growable: false);
await store.write<CacheEntry<List<TodoResponse>>>(
pendingListKey,
@@ -58,9 +54,9 @@ class TodoRepository {
);
}
invalidator.invalidate(pendingListKey);
try {
await api.completeTodo(id);
invalidator.invalidate(pendingListKey);
} catch (error) {
if (cached != null) {
await store.write<CacheEntry<List<TodoResponse>>>(