From 3128ddc593703d2b7585f58e6b4435da24f6385d Mon Sep 17 00:00:00 2001 From: Carlos Date: Sun, 26 Apr 2026 18:29:32 -0400 Subject: [PATCH] Fix 'failed to load group' on click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The detail-panel insertion logic mixed parent contexts: it called grid.parentNode.insertBefore() but used a child-of-grid as the reference node. insertBefore requires the reference node to be a child of the target parent — it threw 'node is not a child of this node' on every click. Replaced the inter-row positioning with simple insert-after-grid. Same visual outcome since panel.scrollIntoView() handles user focus. Co-Authored-By: Claude Opus 4.7 --- debian/build-deb.sh | 2 +- templates/index.html | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/debian/build-deb.sh b/debian/build-deb.sh index 56ea70e..aeed470 100644 --- a/debian/build-deb.sh +++ b/debian/build-deb.sh @@ -13,7 +13,7 @@ BUILD_DIR="$REPO_ROOT/build/deb" # ── Config ──────────────────────────────────────────────────────────────────── PKG_NAME="dupfinder" -PKG_VERSION="1.0.9" +PKG_VERSION="1.0.10" PKG_ARCH="amd64" DEB_FILE="${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH}.deb" diff --git a/templates/index.html b/templates/index.html index 55aedb8..11e7c05 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1288,19 +1288,13 @@ async function openGroup(groupId, cellEl) { state.activeGroupData = g; renderDetail(g); - // Insert detail panel after the row containing the clicked cell + // Position detail panel directly after the grid (in the grid's parent). + // Earlier we tried to thread it between grid rows but mixed parent + // contexts and threw "node is not a child of this node". const panel = el('detail-panel'); const grid = el('gallery-grid'); - if (cellEl) { - // find row end - const cellRect = cellEl.getBoundingClientRect(); - const gridRect = grid.getBoundingClientRect(); - const cells = Array.from(grid.children).filter(c => c.classList.contains('gallery-cell')); - const cols = Math.round(grid.offsetWidth / (cellEl.offsetWidth + 12)); - const cellIdx = cells.indexOf(cellEl); - const rowEnd = Math.min(Math.ceil((cellIdx + 1) / cols) * cols, cells.length); - const afterCell = cells[rowEnd - 1]; - grid.parentNode.insertBefore(panel, afterCell.nextSibling || el('load-more-wrap')); + if (panel.parentNode !== grid.parentNode || panel.previousSibling !== grid) { + grid.parentNode.insertBefore(panel, grid.nextSibling); } panel.classList.add('show'); panel.scrollIntoView({ behavior: 'smooth', block: 'nearest' });