Skip to content

Commit

Permalink
remove dates check for keep items fetching flag
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymikhadyuk committed Dec 5, 2023
1 parent 3fd41f6 commit c137236
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/store/states/inbox/saga/refreshUnreadInboxItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,9 @@ import * as actions from "../actions";
import { selectInboxItems } from "../selectors";
import { InboxItems } from "../types";

const checkCanKeepFetchingByDate = (
firstDocTimestamp: Timestamp | null,
lastDocTimestamp: Timestamp | null,
): boolean => {
if (!firstDocTimestamp) {
return true;
}
if (!lastDocTimestamp) {
return false;
}

return lastDocTimestamp.seconds >= firstDocTimestamp.seconds;
};

export function* refreshUnreadInboxItems() {
try {
const currentItems = (yield select(selectInboxItems)) as InboxItems;
const { firstDocTimestamp } = currentItems;
const newInboxItems: FeedLayoutItemWithFollowData[] = [];
let startAfter: Timestamp | null = null;
let keepItemsFetching = true;
Expand Down Expand Up @@ -65,9 +50,7 @@ export function* refreshUnreadInboxItems() {
),
);
newInboxItems.push(...chatChannelItems, ...feedItemFollowItems);
keepItemsFetching =
hasMore &&
checkCanKeepFetchingByDate(firstDocTimestamp, lastDocTimestamp);
keepItemsFetching = hasMore;
startAfter = lastDocTimestamp;
}

Expand Down

0 comments on commit c137236

Please sign in to comment.