fix(playlists): update timestamp of recently viewed items

This commit is contained in:
4gray committed 2026-02-16 22:16:12 +01:00
1 parent 52a618fd0f
commit 0623baa4b7
2 files changed
+49 -7

No files matched your search

@@ -62,15 +62,37 @@ export const withRecentItems = function () {
pipe(
switchMap(async ({ contentId, playlist }) => {
// contentId is actually xtream_id, need to look up the database content.id
const playlistId = playlist().id;
const content = await dbService.getContentByXtreamId(
contentId,
playlist().id
playlistId
);
if (content) {
await dbService.addRecentItem(
content.id,
playlist().id
playlistId
);
// Reload after add/update so re-watched items
// immediately move to the top in recently-viewed.
const items =
await dbService.getRecentItems(playlistId);
patchState(store, {
recentItems: items.map((item) => ({
id: item.id,
title: item.title,
type: item.type as
| 'live'
| 'movie'
| 'series',
poster_url: item.poster_url,
content_id: item.id,
playlist_id: playlistId,
viewed_at: item.viewed_at || '',
xtream_id: item.xtream_id,
category_id: item.category_id,
})),
});
}
})
)