fix(library): a local node's frames stand under the key the column files them by
The column files a local folder as an absolute key — `/2012` — while a frame carries its own `dir` as a path from the root, `2012`. `shown` set the two against each other as they stood, so a frame's dir was never the node's dir, and never under it either: every folder in the disk tree was counted in the row above it and stood in no pane at all — the wall white, the frames nowhere. The key sheds the slash it leads with before the two are set against each other, the way `markOf` already cleans a reading's own path. Measured on the live account's own catalogue — 112761 frames, 6 under `/2012`: the node matched 0 frames before, 6 after; the root's own list is untouched (927).
This commit is contained in:
@@ -1869,9 +1869,14 @@ function Catalogue({ admin, user }: { admin: boolean; user: User | null }) {
|
||||
const isImmich = rootFolder.source === 'immich';
|
||||
const normRoot = normPath(rootName).toLowerCase();
|
||||
const normNode = normPath(node ?? '').toLowerCase();
|
||||
const dir = normNode === normRoot
|
||||
// A node's key is the path the column gave it, and a local root's is
|
||||
// absolute — the disk's `/2012`, where the cloud's is `IMMICH2194` — while a
|
||||
// frame's own `dir` is never absolute. The key sheds the slash it leads with
|
||||
// before the two are set against each other, or every frame under a local
|
||||
// folder counts in the row above it and stands in no pane at all.
|
||||
const dir = (normNode === normRoot
|
||||
? ''
|
||||
: (normRoot ? (normNode.startsWith(`${normRoot}/`) ? normNode.slice(normRoot.length + 1) : normNode) : normNode);
|
||||
: (normRoot ? (normNode.startsWith(`${normRoot}/`) ? normNode.slice(normRoot.length + 1) : normNode) : normNode)).replace(/^\/+/, '');
|
||||
const below = dir === ''
|
||||
? (p: LibraryPhoto) => normPath(p.dir ?? '') !== ''
|
||||
: (p: LibraryPhoto) => normPath(p.dir ?? '').toLowerCase().startsWith(`${dir}/`);
|
||||
|
||||
Reference in New Issue
Block a user