Skip to content

Commit

Permalink
fix: stable mark all feed list, fixed #245
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Aug 30, 2024
1 parent 4287b5d commit c9d098f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/renderer/src/store/subscription/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/store/unread/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c9d098f

Please sign in to comment.