Skip to content

Commit 09ccd39

Browse files
authored
fix(mobile): read state not updated after mark view as read (#2875)
1 parent 150fbf7 commit 09ccd39

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

apps/mobile/src/store/unread/store.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ class UnreadSyncService {
3030
return res.data
3131
}
3232

33+
private async updateUnreadStatus(feedIds: string[]) {
34+
await unreadActions.upsertMany(feedIds.map((id) => ({ subscriptionId: id, count: 0 })))
35+
entryActions.markEntryReadStatusInSession({ feedIds, read: true })
36+
await EntryService.patchMany({
37+
feedIds,
38+
entry: { read: true },
39+
})
40+
}
41+
3342
async markViewAsRead(view: FeedViewType) {
3443
await apiClient.reads.all.$post({
3544
json: {
@@ -38,7 +47,7 @@ class UnreadSyncService {
3847
})
3948

4049
const subscriptionIds = getSubscriptionByView(view)
41-
await unreadActions.upsertMany(subscriptionIds.map((id) => ({ subscriptionId: id, count: 0 })))
50+
this.updateUnreadStatus(subscriptionIds)
4251
}
4352

4453
async markFeedAsRead(feedId: string | string[]) {
@@ -48,12 +57,7 @@ class UnreadSyncService {
4857
json: { feedIdList: feedIds },
4958
})
5059

51-
await unreadActions.upsertMany(feedIds.map((id) => ({ subscriptionId: id, count: 0 })))
52-
entryActions.markEntryReadStatusInSession({ feedIds, read: true })
53-
await EntryService.patchMany({
54-
feedIds,
55-
entry: { read: true },
56-
})
60+
this.updateUnreadStatus(feedIds)
5761
}
5862

5963
async markEntryAsRead(entryId: string) {

0 commit comments

Comments
 (0)