Fix 'failed to load group' on click
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 <noreply@anthropic.com>
This commit is contained in:
2
debian/build-deb.sh
vendored
2
debian/build-deb.sh
vendored
@@ -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"
|
||||
|
||||
|
||||
@@ -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' });
|
||||
|
||||
Reference in New Issue
Block a user