fix(library): sync React photos state after scan and support case-insensitive existing photo lookup
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user