dav: improve de-duplication for extend

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/953/head
Varun Patil 2023-11-24 14:01:17 -08:00
parent 9bc77aeb89
commit f2f6899d53
1 changed files with 7 additions and 3 deletions

View File

@ -194,10 +194,14 @@ export async function extendWithStack(photos: IPhoto[]) {
} }
// Add stacked RAW files (deduped) // Add stacked RAW files (deduped)
const stackRaw = Array.from(new Set(photos.map((p) => p.stackraw ?? []).flat())); const stackRaw = photos.map((p) => p.stackraw ?? []).flat();
// Combine and return // Combine all files
return photos.concat(livePhotos, stackRaw); const combined = photos.concat(livePhotos, stackRaw);
// De-duplicate
const unique = new Map<number, IPhoto>(combined.map((p) => [p.fileid, p]));
return Array.from(unique.values());
} }
/** /**