diff --git a/public/compare.js b/public/compare.js index b10f1670..9753f17c 100644 --- a/public/compare.js +++ b/public/compare.js @@ -132,6 +132,13 @@ if (typeof window !== 'undefined') { routeFilter = 'all'; } + // #1646 round-2 — single shared "should we run a comparison?" predicate + // used by every auto-run call site so guards cannot drift apart. + // URL-prepopulated ?a=X&b=X (same observer in both slots) returns false. + function isComparisonReady() { + return !!(selA && selB && selA !== selB); + } + async function loadObservers() { try { var data = await api('/observers', { ttl: CLIENT_TTL.observers }); @@ -139,7 +146,7 @@ if (typeof window !== 'undefined') { return (a.name || a.id).localeCompare(b.name || b.id); }); renderControls(); - if (selA && selB) runComparison(); + if (isComparisonReady()) runComparison(); } catch (e) { document.getElementById('compareControls').innerHTML = '
Error loading observers: ' + escapeHtml(e.message) + '
'; @@ -161,14 +168,15 @@ if (typeof window !== 'undefined') { '
' + '
' + '' + + '' + '' + '
' + 'vs' + '
' + '' + + '' + '' + '
' + - '' + '
' + '' + '