fix: read activity shards in GET /api/feed; improve sync feedback
_merged/index.json is a shard manifest with activities:[] when the user
has >FEED_PAGE_SIZE activities. The endpoint now collects from all
index-{year}.json shard files before returning.
SyncResult gains a `total` field (activities received from server) so the
feed screen can distinguish "server returned nothing" from "all already
stored locally". Messages: "No activities on instance" / "Up to date (N)"
/ "X of N activities synced".
This commit is contained in:
@@ -18,10 +18,12 @@ export default function FeedScreen() {
|
||||
setSyncing(false);
|
||||
if (result.error) {
|
||||
setSyncMsg(result.error);
|
||||
} else if (result.total === 0) {
|
||||
setSyncMsg('No activities on instance');
|
||||
} else if (result.synced === 0) {
|
||||
setSyncMsg('Already up to date');
|
||||
setSyncMsg(`Up to date (${result.total} activities)`);
|
||||
} else {
|
||||
setSyncMsg(`${result.synced} ${result.synced === 1 ? 'activity' : 'activities'} synced`);
|
||||
setSyncMsg(`${result.synced} of ${result.total} activities synced`);
|
||||
}
|
||||
setTimeout(() => setSyncMsg(null), 3500);
|
||||
}, [db]);
|
||||
|
||||
Reference in New Issue
Block a user