From b8d7bac497e6e1db5d7c1e5e2ba94441bd662ba8 Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Tue, 4 Aug 2026 19:40:49 +0200 Subject: [PATCH] fix(frontend): preserve URN download panel container --- tests/test_downloads_tab_workflow_route.mjs | 8 ++++++++ web/resolver/actions/resolve_download_methods.js | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/test_downloads_tab_workflow_route.mjs b/tests/test_downloads_tab_workflow_route.mjs index 03afc45..fb49992 100644 --- a/tests/test_downloads_tab_workflow_route.mjs +++ b/tests/test_downloads_tab_workflow_route.mjs @@ -5205,6 +5205,14 @@ test('local match refreshes preserve keyed rows and button handlers', () => { assert.doesNotMatch(wireLocalMatchButtons, /addEventListener\('click'/); }); +test('URN resolution preserves the download panel container', () => { + const resolveUrnAsync = extractMethod(resolveDownloadMethodsSource, 'resolveUrnAsync'); + + assert.doesNotMatch(resolveUrnAsync, /downloadEl\.outerHTML\s*=/); + assert.match(resolveUrnAsync, /downloadEl\.innerHTML\s*=\s*this\.renderKnownDownloadPanel/); + assert.match(resolveUrnAsync, /wireDownloadSearchPanel\(downloadEl, missing\)/); +}); + test('local match status group warns when match folder is unsupported by node', () => { const renderLocalMatchStatus = eval(`(${extractMethod(searchPanelMethodsSource, 'renderLocalMatchStatus')})`); const getLocalMatchCategory = eval(`(${extractMethod(searchPanelMethodsSource, 'getLocalMatchCategory')})`); diff --git a/web/resolver/actions/resolve_download_methods.js b/web/resolver/actions/resolve_download_methods.js index dd3002a..1ea5b04 100644 --- a/web/resolver/actions/resolve_download_methods.js +++ b/web/resolver/actions/resolve_download_methods.js @@ -2873,9 +2873,8 @@ export const resolveDownloadMethods = { if (missing) { this.applyCivitaiUrnResult(missing, data.civitai); this.refreshSearchBaseModelLabels?.(); - const downloadParent = downloadEl.parentElement; - downloadEl.outerHTML = this.renderKnownDownloadPanel(missing, missing.download_source); - this.wireDownloadSearchPanel(downloadParent || this.contentElement, missing); + downloadEl.innerHTML = this.renderKnownDownloadPanel(missing, missing.download_source); + this.wireDownloadSearchPanel(downloadEl, missing); this.refreshUrnLocalMatches(missing); } } else if (downloadEl) {