fix(library): mark only the folder a reading stands in, and keep a one-folder reading out of the roll's count

The column's ring was drawn from the open node's roll: a row of another roll
had no path under it, so the empty prefix matched every row of the roll being
read and the whole column lit up. The roll's own row was marked too, at every
moment of a reading of it, and a reading kept to one folder counted its frames
onto the roll's row as well — a roll counted down to one branch of itself.
A queued request was drawn from the reading's roll instead of its own, so a
request on a second roll showed nothing at all.
This commit is contained in:
3dtours
2026-10-07 23:10:21 +07:00
parent 8bc5e08926
commit c80c8729a8
2 changed files with 35 additions and 9 deletions
+28 -8
View File
@@ -1656,14 +1656,34 @@ function Catalogue() {
// left bare, and the toolbar's line is what carries them.
const isScanFolderMatch = !!(live && folder && normPath(live.folder) === normPath(folder.name));
const scanAt = live?.progress.at ? normPath(live.progress.at) : '';
const nodeRel = (relOf(n.key) ?? '').replace(/\/$/, '');
const scanning = isScanFolderMatch && (
n.depth === 0 ? true : (scanAt === nodeRel || scanAt.startsWith(nodeRel ? `${nodeRel}/` : ''))
);
const waiting = !scanning && isScanFolderMatch && scanQueue().some((j) => {
const qRel = (j.rel ?? '').replace(/\/$/, '');
return qRel === nodeRel || qRel.startsWith(nodeRel ? `${nodeRel}/` : '');
});
// The row's own path under its own roll, spelled the way the
// walk spells one. Not `relOf`, which answers for the open
// node's roll alone: a reading of another roll draws its ring
// on that roll's rows too, and those rows still have to say
// where it stands.
const normFolder = folder ? normPath(folder.name) : '';
const nodeRel =
n.depth === 0 || !normFolder || !n.key.startsWith(`${normFolder}/`)
? ''
: n.key.slice(normFolder.length + 1);
const scanning =
isScanFolderMatch &&
n.depth > 0 &&
nodeRel !== '' &&
(scanAt === nodeRel || scanAt.startsWith(`${nodeRel}/`));
// What is waiting its turn is waiting on the row it was asked
// of, and on every row above it: a request under a folded
// branch still says the roll has work queued. The roll's own
// row says nothing, for the reason it says nothing of the
// reading — and a request belongs to the roll it was asked
// of, so another roll's queue is not this row's news.
const waiting =
!scanning &&
n.depth > 0 &&
nodeRel !== '' &&
scanQueue().some(
(j) => j.folder === folder?.name && (j.rel === `${nodeRel}/` || j.rel.startsWith(`${nodeRel}/`))
);
const under = parents.has(n.key);
return (
<button
+7 -1
View File
@@ -793,7 +793,13 @@ export async function scanFolder(
const relNorm = rel.replace(/\\/g, '/');
const cut = relNorm.lastIndexOf('/');
const normRoot = normPath(folder.name);
counts[normRoot] = (counts[normRoot] ?? 0) + 1;
// A reading kept to one folder says nothing about the roll it sits in: the
// roll's own row counts every frame of the roll, and a number that counted
// one branch of it would count the roll down to that branch. Its own frames
// are outside the reading anyway — a bounded walk starts at `from`, so every
// frame it reaches is under it, and the roll's row keeps the catalogue's
// number until the reading is through and the catalogue is read back.
if (!bounded) counts[normRoot] = (counts[normRoot] ?? 0) + 1;
let path = '';
for (const part of (cut < 0 ? '' : relNorm.slice(0, cut)).split('/')) {
if (!part) continue;