Fix static dashboard injection flow

This commit is contained in:
calesthio
2026-03-17 13:47:55 -07:00
parent cd206e4efd
commit 54bbcd4b04
2 changed files with 46 additions and 7 deletions

View File

@@ -1202,9 +1202,10 @@ function init(){
}
document.addEventListener('DOMContentLoaded', () => {
const isServer = location.protocol !== 'file:';
const hasInlineData = !!(D && D.meta);
const canProbeApi = location.protocol !== 'file:';
if (isServer) {
if (canProbeApi && !hasInlineData) {
// Server mode: always fetch live data from API (ignore any stale inline D)
fetch('/api/data')
.then(r => r.json())
@@ -1213,7 +1214,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Should not reach here — server routes to loading.html when no data
if (D && D.meta) { init(); connectSSE(); }
});
} else if (D && D.meta) {
} else if (hasInlineData) {
// File mode: use inline data
init();
}