Changelog 63851b0tree, with Claude Opus 5.5
History: load every year while scrolling (2025 was skipped)
The loader counted the list's children to know which years were in the page; the script Astro writes into the list counted as one more, so the first load started a year too far.
1 file of code, design or docs +5 −4 lines
Code, design and documents 1 file
src/components/HistoryList.astro +5 −4
@@ -331,5 +331,5 @@ const scoredAll = feed ? stats.scored : items.filter((ch) => ch.score).length; } else { if (order === "oldest") { - box.append(...[...box.children].reverse()); + box.append(...[...box.querySelectorAll(":scope > .hist-year")].reverse()); box.querySelectorAll(".hist-year").forEach(flip); box.dataset.order = "oldest"; @@ -348,5 +348,5 @@ const scoredAll = feed ? stats.scored : items.filter((ch) => ch.score).length; order = value; press(orderButtons, "order", order); - box.append(...[...box.children].reverse()); + box.append(...[...box.querySelectorAll(":scope > .hist-year")].reverse()); box.querySelectorAll(".hist-year").forEach(flip); box.dataset.order = order; @@ -381,6 +381,7 @@ const scoredAll = feed ? stats.scored : items.filter((ch) => ch.score).length; const sentinel = document.querySelector(".hist-sentinel"); const cache = new Map(); - // the loaded years are a run of the index from `lo` to `hi`, whatever the order - let lo = 0, hi = box.children.length - 1, busy = false, run = 0; + // the loaded years are a run of the index from `lo` to `hi`, whatever the order; only the year + // sections count (Astro writes the HistoryYears script into the list too) + let lo = 0, hi = box.querySelectorAll(":scope > .hist-year").length - 1, busy = false, run = 0; const step = () => (order === "newest" ? 1 : -1); const bottom = () => (order === "newest" ? hi + 1 : lo - 1);