remove item dedup

This commit is contained in:
chrisk325 2026-03-15 17:14:55 +05:30 committed by GitHub
parent 7efd21d442
commit 6d34935352
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1647,21 +1647,16 @@ class CatalogService {
if (controller.cancelled) return;
// Sort by catalogIndex (addon manifest order + position within addon), then dedup and emit
// Sort by catalogIndex (addon manifest order + position within addon) then emit.
// No cross-section dedup — each section is shown separately so duplicates across
// sections are intentional (e.g. same movie in Cinemeta and People Search).
allPendingSections.sort((a, b) => a.catalogIndex - b.catalogIndex);
const globalSeen = new Set<string>();
for (const section of allPendingSections) {
if (controller.cancelled) return;
const unique = section.results.filter(item => {
const key = `${item.type}:${item.id}`;
if (globalSeen.has(key)) return false;
globalSeen.add(key);
return true;
});
if (unique.length > 0) {
logger.log(`Emitting ${unique.length} results from ${section.sectionName}`);
onAddonResults({ addonId: section.addonId, addonName: section.addonName, sectionName: section.sectionName, catalogIndex: section.catalogIndex, results: unique });
if (section.results.length > 0) {
logger.log(`Emitting ${section.results.length} results from ${section.sectionName}`);
onAddonResults({ addonId: section.addonId, addonName: section.addonName, sectionName: section.sectionName, catalogIndex: section.catalogIndex, results: section.results });
}
}
})();