fix: fetch host info on initial page load
DOMContentLoaded was calling fetchHostGlance but not fetchHostInfo, leaving the info-meta section stuck on "Loading…". Both the URL-hash and default first-host paths now call fetchHostInfo and populate infoCache on load. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1336,14 +1336,29 @@
|
|||||||
if (card) {
|
if (card) {
|
||||||
card.classList.remove('collapsed');
|
card.classList.remove('collapsed');
|
||||||
fetchHostGlance(hostname);
|
fetchHostGlance(hostname);
|
||||||
|
fetchHostInfo(hostname).then(data => {
|
||||||
|
infoCache[hostname] = data;
|
||||||
|
renderInfoSection(hostname, data);
|
||||||
|
}).catch(() => {
|
||||||
|
const el = document.getElementById(`info-${hostname}`);
|
||||||
|
if (el) el.innerHTML = '<div class="info-loading">Could not load host info.</div>';
|
||||||
|
});
|
||||||
setTimeout(() => card.scrollIntoView({ behavior: 'smooth', block: 'start' }), 150);
|
setTimeout(() => card.scrollIntoView({ behavior: 'smooth', block: 'start' }), 150);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const first = document.querySelector('.host-card');
|
const first = document.querySelector('.host-card');
|
||||||
if (first) {
|
if (first) {
|
||||||
|
const hostname = first.dataset.hostname;
|
||||||
first.classList.remove('collapsed');
|
first.classList.remove('collapsed');
|
||||||
fetchHostGlance(first.dataset.hostname);
|
fetchHostGlance(hostname);
|
||||||
|
fetchHostInfo(hostname).then(data => {
|
||||||
|
infoCache[hostname] = data;
|
||||||
|
renderInfoSection(hostname, data);
|
||||||
|
}).catch(() => {
|
||||||
|
const el = document.getElementById(`info-${hostname}`);
|
||||||
|
if (el) el.innerHTML = '<div class="info-loading">Could not load host info.</div>';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// ── Host action helpers ──────────────────────────────────────
|
// ── Host action helpers ──────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user