fix(library): sync React photos state after scan and support case-insensitive existing photo lookup

This commit is contained in:
2026-10-08 20:50:18 +07:00
parent e1d6b90322
commit db7ce04613
3 changed files with 26 additions and 11 deletions
+7 -6
View File
@@ -796,15 +796,12 @@ function Catalogue() {
// roll, and the rows outside the folder being re-read are rows the
// reader is looking at.
if (!from) setDirs(result.dirs);
// No read back here. The reading handed its frames over as it stored
// them, and the screen watching it reads the catalogue back once the
// reading is done — the same read, half a beat later, and not a second
// one of the whole catalogue for a strip that is already drawn.
await reload();
} catch {
setNote(t('lib.failed'));
}
},
[t]
[reload, t]
);
// The folder this screen is on is read back to the disk on the way in, and again
@@ -1003,6 +1000,7 @@ function Catalogue() {
// numbers drawn over the column would count a roll down to a branch of itself.
// The column falls back on the catalogue until the reading is through.
const read = live ? live.progress.counts : null;
const liveDirs = live ? live.progress.dirs : null;
// Memoize photo count map derived from photos and dirs array separately so that
// live scan progress ticks (every 200ms) do not re-scan tens of thousands of photos.
const baseTreeInfo = useMemo(() => {
@@ -1032,8 +1030,11 @@ function Catalogue() {
if (normDir) add(normF, normDir, true);
}
for (const dir of dirs) add(dir.folder, dir.rel, false);
if (liveDirs) {
for (const dir of liveDirs) add(dir.folder, dir.rel, false);
}
return { hits, foldersUnder };
}, [photos, dirs]);
}, [photos, dirs, liveDirs]);
const nodes = useMemo<Node[]>(() => {
const { hits, foldersUnder } = baseTreeInfo;