dav: improve de-duplication for extend
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/953/head
parent
9bc77aeb89
commit
f2f6899d53
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue