From 4cefb35b713c965877b47b4eca516794fcd077a6 Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Mon, 22 Jun 2026 02:52:34 +0200 Subject: [PATCH] Persist local match alternatives collapsed state Store the expanded/collapsed state of local match alternative sections in localStorage so the UI preference is remembered across sessions. --- web/resolver/globals.js | 3 +++ web/resolver/resolver_dialog.js | 6 ++++++ web/resolver/search/search_panel.js | 31 ++++++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/web/resolver/globals.js b/web/resolver/globals.js index fad295d..7115474 100644 --- a/web/resolver/globals.js +++ b/web/resolver/globals.js @@ -7,6 +7,9 @@ const isHidden = element.classList.toggle('mr-hidden'); if (trigger) { trigger.setAttribute('aria-expanded', String(!isHidden)); + if (trigger.dataset?.mlPreference === 'local-match-alternatives') { + window.ModelResolverDialog?.setLocalMatchAlternativesCollapsed?.(isHidden); + } const label = trigger.querySelector?.('.mr-local-alternatives-label'); const state = trigger.querySelector?.('.mr-local-alternatives-state'); if (label || state) { diff --git a/web/resolver/resolver_dialog.js b/web/resolver/resolver_dialog.js index afcc5be..a8f6b8a 100644 --- a/web/resolver/resolver_dialog.js +++ b/web/resolver/resolver_dialog.js @@ -69,11 +69,17 @@ export class ResolverManagerDialog extends ComfyDialog { this.sidebarOpenModeStorageKey = "model_resolver_sidebar_open_mode"; this.missingBrowserSplitStorageKey = "model_resolver_missing_browser_detail_w"; this.showResolvedModelsStorageKey = "model_resolver_show_resolved_models"; + this.localMatchAlternativesCollapsedStorageKey = "model_resolver_local_match_alternatives_collapsed"; try { this.showResolvedModels = localStorage.getItem(this.showResolvedModelsStorageKey) === '1'; } catch (e) { this.showResolvedModels = false; } + try { + this.localMatchAlternativesCollapsed = localStorage.getItem(this.localMatchAlternativesCollapsedStorageKey) === '1'; + } catch (e) { + this.localMatchAlternativesCollapsed = false; + } this.dockButton = null; this.undockButton = null; this._floatingRectBeforeDock = null; diff --git a/web/resolver/search/search_panel.js b/web/resolver/search/search_panel.js index ace5d37..2299242 100644 --- a/web/resolver/search/search_panel.js +++ b/web/resolver/search/search_panel.js @@ -1763,6 +1763,30 @@ export const searchPanelMethods = { }; }, + areLocalMatchAlternativesCollapsed() { + if (typeof this.localMatchAlternativesCollapsed === 'boolean') { + return this.localMatchAlternativesCollapsed; + } + + try { + this.localMatchAlternativesCollapsed = localStorage.getItem(this.localMatchAlternativesCollapsedStorageKey) === '1'; + } catch (e) { + this.localMatchAlternativesCollapsed = false; + } + + return this.localMatchAlternativesCollapsed; + }, + + setLocalMatchAlternativesCollapsed(collapsed) { + this.localMatchAlternativesCollapsed = Boolean(collapsed); + try { + localStorage.setItem( + this.localMatchAlternativesCollapsedStorageKey, + this.localMatchAlternativesCollapsed ? '1' : '0' + ); + } catch (e) {} + }, + renderLocalMatchesContent(missing, missingIndex = 0) { const allMatches = missing.matches || []; const filteredMatches = allMatches.filter(m => m.confidence >= 70); @@ -1804,12 +1828,13 @@ export const searchPanelMethods = { if (perfectMatches.length > 0 && otherMatches.length > 0) { const matchId = `more-matches-${missing.node_id}-${missing.widget_index}`; const altLabel = `Alternatives (${otherMatches.length})`; - html += ``; - html += `
`; + html += `
`; for (let mIdx = 0; mIdx < otherMatches.length; mIdx++) { const match = otherMatches[mIdx]; const altBtnId = `resolve-alt-${missingIndex}-${missing.node_id}-${missing.widget_index}-${mIdx}`;