fix: stable mark all feed list, fixed #245

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-08-30 17:03:20 +08:00
parent 4287b5d986
commit c9d098f4e9
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
2 changed files with 6 additions and 3 deletions

View File

@ -153,16 +153,18 @@ class SubscriptionActions {
async markReadByFeedIds(...args: [string[], FeedViewType?, MarkReadFilter?]) {
const [feedIds, view, filter] = args
const stableFeedIds = feedIds.concat()
doMutationAndTransaction(
() =>
apiClient.reads.all.$post({
json: {
feedIdList: feedIds,
feedIdList: stableFeedIds,
...filter,
},
}),
async () => {
for (const feedId of feedIds) {
for (const feedId of stableFeedIds) {
// We can not process this logic in local, so skip it. and then we will fetch the unread count from server.
!filter && feedUnreadActions.updateByFeedId(feedId, 0)
entryActions.patchManyByFeedId(feedId, { read: true }, filter)

View File

@ -34,9 +34,10 @@ class FeedUnreadActions {
for (const [key, value] of data) {
state.data[key] = value
}
FeedUnreadService.updateFeedUnread(data)
return { ...state }
})
FeedUnreadService.updateFeedUnread(data)
}
async fetchUnreadByView(view: FeedViewType | undefined) {