fix(library): the folder picked is the folder that is shown

A node drew every frame of the branch under it unless the reader shut the
subfolders out, so picking A drew A and everything below it. The pick is
now the scope — the node's own frames — and the branch is what the
SUB FOLDERS chip asks for.

The year filter was already read off the frames the open node drew, so
it follows the same pick. On a tree of 13 frames (r1 r2 | A/a1..a3 |
A/deep/d1 | C/c1..c6 | E/e1, one year per folder) the chip off offers
2024 on the root, 2023 on A, 2022 on A/deep and 2021 on C; the chip on
offers all five years on the root and 2023+2022 on A.

The remembered answer moves to a new key: the chip wrote its first answer
down on the very first visit, so the old key holds 'true' for every
reader who never touched it, and reading it would keep them on a default
they never chose.
This commit is contained in:
2026-10-08 17:29:34 +07:00
parent 7f611b2171
commit 2a3dd6fdbe
+13 -8
View File
@@ -82,7 +82,11 @@ const NODE_KEY = 'recipescam.library.node';
const FRAME_KEY = 'recipescam.library.frame';
const COLUMN_KEY = 'recipescam.library.column';
const OPEN_KEY = 'recipescam.library.open';
const DEEP_KEY = 'recipescam.library.deep';
// The name moved with the default: subfolders used to be drawn unless the reader
// shut them out, and the chip wrote that first answer down on the very first
// visit — so the old key holds 'true' for every reader who never touched it, and
// reading it would keep them on a default they never chose.
const DEEP_KEY = 'recipescam.library.deep2';
const VIEW_KEY = 'recipescam.library.view';
const SORT_BY_KEY = 'recipescam.library.sortBy';
const SORT_DIR_KEY = 'recipescam.library.sortDir';
@@ -327,10 +331,12 @@ function Catalogue() {
return set;
});
// Whether the strip draws the whole branch under the open node or only the
// node itself. Deep is how a roll reads — its top level holds no file of its
// own — and shallow is what a folder of folders is for. The reader's answer is
// picked up where the last visit left it, the same as the open node above.
const [deep, setDeep] = useState(() => recall(DEEP_KEY) !== 'false');
// node itself. The node the reader picked is what the screen shows: the frames
// in the folders under it are asked for, not assumed. A roll whose top level
// holds date folders then reads as those folders, and the frames behind them
// arrive when the reader says so. The answer is picked up where the last visit
// left it, the same as the open node above.
const [deep, setDeep] = useState(() => recall(DEEP_KEY) === 'true');
// The frame that is up in the open node — raised by a click on its thumbnail,
// and picked up where the last visit left it, so a reader who leaves for the
// studio comes back to the negative they were looking at rather than to the
@@ -1086,9 +1092,8 @@ function Catalogue() {
setNode(nodes.find((n) => n.key === node.split('/')[0])?.key ?? nodes[0]?.key ?? null);
}, [loaded, node, nodes]);
// What the open node draws: its own frames, and — unless the branch has been
// shut out of the strip — the ones in every subfolder under it, because a
// roll's top level usually holds no file of its own.
// What the open node draws: its own frames, and — when the reader has asked
// for the branch — the ones in every subfolder under it.
const shown = useMemo(() => {
if (!rootName) return photos;
const normRoot = rootName.replace(/\\/g, '/');