fix: the left arrow no longer skips over what you just tagged
Some checks are pending
CI / check (push) Waiting to run

--untagged hid an item the moment it gained a tag, including from the back
button, so the one photo you most want to return to -- the one you just
mis-tagged -- was the one you could not reach. The only way back was to
restart without --untagged.

Anything drawn this session stays navigable. Forward still skips work done
in earlier sessions, which is the point of the flag.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WBrE1b9HvFw3xvG9bJiDFt
This commit is contained in:
Krzysztof Rudnicki 2026-08-31 13:40:40 +02:00
parent d3d89c890e
commit 0f3da7308d

View File

@ -189,8 +189,14 @@ function isVideo(name) {
// Which items this session presents. The server never filters: /media/{index}
// and /api/tag both index the full list, so a shorter list here would show
// item i of the album while tagging item i of the filtered set.
// Anything seen this session stays navigable even once it has tags. Without
// this, tagging an item removes it from the set and the left arrow jumps
// straight over your own work -- so a mis-tag is unreachable and the only way
// back is to restart without --untagged.
const visited = new Set();
function shown(index) {
return !state.untagged_only || !state.files[index].keys.length;
return !state.untagged_only || !state.files[index].keys.length || visited.has(index);
}
function step(from, direction) {
@ -201,6 +207,7 @@ function step(from, direction) {
}
function draw() {
visited.add(at);
const item = state.files[at];
document.getElementById("progress").textContent =
`${at + 1} / ${state.files.length} — ${item.name}`;