mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 19:02:28 +00:00
Fix watch history feed dropping older entries
This commit is contained in:
1 parent
7c3af36003
commit
94eb750854
1 file changed
+3
-8
@@ -137,19 +137,14 @@ function createWatchHistorySource({ service = watchHistoryService } = {}) {
|
||||
items = [];
|
||||
}
|
||||
|
||||
const map = new Map();
|
||||
const results = [];
|
||||
for (const raw of Array.isArray(items) ? items : []) {
|
||||
const normalized = normalizeHistoryEntry(raw);
|
||||
if (!normalized) {
|
||||
continue;
|
||||
}
|
||||
const existing = map.get(normalized.pointerKey);
|
||||
if (!existing || existing.watchedAt < normalized.watchedAt) {
|
||||
map.set(normalized.pointerKey, normalized);
|
||||
if (normalized) {
|
||||
results.push(normalized);
|
||||
}
|
||||
}
|
||||
|
||||
const results = Array.from(map.values());
|
||||
results.sort((a, b) => {
|
||||
if (a.watchedAt !== b.watchedAt) {
|
||||
return b.watchedAt - a.watchedAt;
|
||||
|
||||
Reference in new issue
Block a user