fix(library): draw one tile for a frame a catalogue holds under both spellings

This commit is contained in:
2026-10-13 15:02:22 +07:00
parent e543f21764
commit 6f2c9cc780
2 changed files with 28 additions and 1 deletions
+20 -1
View File
@@ -2541,7 +2541,7 @@ export async function readPhotos(
// being filed twice and `prunePhotos` to drop against the spelling that
// stands. See both.
const raw = folder !== undefined && folder !== root ? folder : null;
const rows: LibraryPhoto[] = [];
let rows: LibraryPhoto[] = [];
let emittedFirst = false;
const sweep = async (base: string): Promise<void> => {
@@ -2578,6 +2578,25 @@ export async function readPhotos(
await sweep(root ?? '');
if (raw) await sweep(raw);
// A catalogue that holds a frame twice — under the id this build computes and
// under the spelling a build before it filed it under — is one frame the
// reader is drawn twice, and this is the read that hands the wall both. The
// two are one path once `normPath` has had them, and what the reader is handed
// is the row that is filed under the path it spells: the other is left where
// it is, and the next reading of that disk drops it. See `prunePhotos`. The
// reading of one folder keeps both, because that is the reading that has the
// frame in hand and the one the drop is made from.
if (folder === undefined) {
const shown = new Set(rows.filter((p) => p.id === normPath(p.id)).map((p) => p.id));
const seen = new Set<string>();
rows = rows.filter((p) => {
const key = normPath(p.id);
if (shown.has(key)) return p.id === key;
if (seen.has(key)) return false;
seen.add(key);
return true;
});
}
rows.sort((a, b) => b.taken - a.taken);
if (!folder) {
cached = rows;