diff --git a/src/scripts/models/item.ts b/src/scripts/models/item.ts index fbe7df8..5eca66c 100644 --- a/src/scripts/models/item.ts +++ b/src/scripts/models/item.ts @@ -312,7 +312,8 @@ const markUnreadDone = (item: RSSItem): ItemActionTypes => ({ }) export function markRead(item: RSSItem): AppThunk { - return dispatch => { + return (dispatch, getState) => { + item = getState().items[item._id] if (!item.hasRead) { db.itemsDB .update(db.items) @@ -377,7 +378,8 @@ export function markAllRead( } export function markUnread(item: RSSItem): AppThunk { - return dispatch => { + return (dispatch, getState) => { + item = getState().items[item._id] if (item.hasRead) { db.itemsDB .update(db.items) diff --git a/src/scripts/models/source.ts b/src/scripts/models/source.ts index f44a547..85c5c06 100644 --- a/src/scripts/models/source.ts +++ b/src/scripts/models/source.ts @@ -483,7 +483,7 @@ export function sourceReducer( } case MARK_ALL_READ: { let nextState = { ...state } - action.sids.map((sid, i) => { + action.sids.forEach((sid) => { nextState[sid] = { ...state[sid], unreadCount: action.time ? state[sid].unreadCount : 0,