Skip to content

Commit

Permalink
fix: seen videos getting auto removed
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Nov 7, 2022
1 parent 664c58f commit f2589f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/store/selectors/videos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ export const selectSeenWatchLaterVideosCount = createSelector(

export const selectVideoFlag = (video: Video, flag: VideoFlag) =>
createSelector(selectVideos, (videos) => {
const { flags } = videos.find(({ id }) => id === video.id) || {};
return flags?.[flag] || false;
const { flags = {} } = videos.find(({ id }) => id === video.id) || {};
return flags[flag] || false;
});
5 changes: 3 additions & 2 deletions src/store/utils/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ const removeOutdatedVideos = (videos: VideoCache[]) => {
({ flags, publishedAt }) =>
flags.toWatchLater ||
flags.bookmarked ||
((flags.recent || flags.seen || flags.ignored) &&
elapsedDays(publishedAt) <= VideosSeniority.OneMonth) ||
flags.seen ||
flags.ignored ||
(flags.recent && elapsedDays(publishedAt) <= VideosSeniority.OneMonth) ||
(flags.notified &&
elapsedDays(publishedAt) <= channelCheckerConfig.videosSeniority),
);
Expand Down

0 comments on commit f2589f5

Please sign in to comment.