← back to 4square Agentabrams
4square: bust sites.json cache + re-resolve selectedSite from fresh sites[] (fixes 'Catalog connection pending' misfire when wiring is fresh)
7bebaa21b76b308441561615ddc50c41f0beae45 · 2026-05-14 09:33:24 -0700 · Steve
Files touched
Diff
commit 7bebaa21b76b308441561615ddc50c41f0beae45
Author: Steve <steve@designerwallcoverings.com>
Date: Thu May 14 09:33:24 2026 -0700
4square: bust sites.json cache + re-resolve selectedSite from fresh sites[] (fixes 'Catalog connection pending' misfire when wiring is fresh)
---
public/index.html | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/public/index.html b/public/index.html
index e52e831..6eb2c6d 100644
--- a/public/index.html
+++ b/public/index.html
@@ -417,7 +417,11 @@
async function loadSites() {
try {
- const r = await fetch('/data/sites.json');
+ // Cache-bust on every load so wiring changes (e.g. new site added to
+ // sites.json) show up without a hard-refresh. 4Square owns the wiring
+ // list and updates frequently; the prod cache layer must NOT pin a
+ // stale copy in front of the user.
+ const r = await fetch('/data/sites.json?cb=' + Date.now(), { cache: 'no-store' });
const j = await r.json();
sites = j.sites || [];
const wired = sites.filter(s => s.source).length;
@@ -470,6 +474,13 @@
async function fetchProducts() {
if (!selectedSite) { $grid.innerHTML = ''; $empty.style.display = ''; return; }
$empty.style.display = 'none';
+ // Always re-lookup the freshest source for this domain from `sites` —
+ // protects against a stale selectedSite snapshot where source was null
+ // before the site got wired. (Caused the "Catalog connection pending"
+ // misfire on 2026-05-14 — metallicwallpaper was wired in sites.json
+ // but a cached selectedSite still showed pending.)
+ const fresh = sites.find(s => s.domain === selectedSite.domain);
+ if (fresh) selectedSite = fresh;
const src = selectedSite.source;
if (!src) {
$grid.innerHTML = '';
← ca61c85 yolo: add Mac2-local refinement loop script + 7-priority tas
·
back to 4square Agentabrams
·
4Square v2: live-hero iframe + server-backed 4-grid sync — d 75c0907 →