🐛 Trying to fix timeline duplicate posts, close #227

This commit is contained in:
2026-01-07 01:55:10 +08:00
parent 3e7007f58f
commit 4ebbda1b14

View File

@@ -62,7 +62,14 @@ class ActivityListNotifier
.where((e) => e.type.startsWith('posts.'))
.map((e) => e.createdAt)
.reduce((a, b) => a.isBefore(b) ? a : b);
cursor = latestCreatedAt.toUtc().toIso8601String();
if (cursor != null) {
final prevCursor = DateTime.tryParse(cursor!);
if (prevCursor != null && prevCursor.isAfter(latestCreatedAt)) {
cursor = latestCreatedAt.toUtc().toIso8601String();
}
} else {
cursor = latestCreatedAt.toUtc().toIso8601String();
}
}
return items;