Fix watch history feed dropping older entries

This commit is contained in:
thePR0M3TH3AN committed 2025-10-04 17:42:34 -04:00
1 parent 7c3af36003
commit 94eb750854
1 file changed
+3 -8
+3 -8
View File
@@ -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;