Skip to content

fix: always fetch live API data in server mode#92

Open
Kampe wants to merge 1 commit intocalesthio:masterfrom
Kampe:fix/always-fetch-live-api-data
Open

fix: always fetch live API data in server mode#92
Kampe wants to merge 1 commit intocalesthio:masterfrom
Kampe:fix/always-fetch-live-api-data

Conversation

@Kampe
Copy link
Copy Markdown

@Kampe Kampe commented Apr 11, 2026

Problem

When running Crucix in Docker/Kubernetes, the dashboard shows stale data from the Docker image build time instead of live intelligence data.

The DOMContentLoaded handler in jarvis.html checks:

if (canProbeApi && !hasInlineData) {

But the inline data variable D is always populated at build time (line 375), so hasInlineData is always true and the /api/data fetch is never executed. The dashboard renders the baked-in snapshot forever.

Fix

Change the condition to just canProbeApi:

if (canProbeApi) {

This makes the dashboard always fetch from /api/data when running on a server (HTTP/HTTPS). File mode (local HTML file) still uses inline data as fallback since canProbeApi is false for file:// protocol.

Impact

  • Docker/K8s deployments now show real-time data instead of build-time snapshot
  • No change to file-mode behavior (offline viewing still works)
  • The connectSSE() call in the fetch handler ensures live updates continue after initial load

🤖 Generated with Claude Code

When running in Docker/Kubernetes, the dashboard serves baked-in data
from the Docker image build time instead of fetching live data from
the API. This is because the DOMContentLoaded handler checks
`canProbeApi && !hasInlineData` — but the inline data `D` variable
is always populated from the build, so `hasInlineData` is always true
and the API fetch is never executed.

The fix changes the condition to just `canProbeApi`, so the dashboard
always fetches from `/api/data` when running on a server (HTTP/HTTPS),
regardless of whether inline data exists. File mode (opened as a local
file) still uses inline data as a fallback.

This caused the dashboard to show data from whenever the Docker image
was built, not live intelligence data.
@Kampe Kampe requested a review from calesthio as a code owner April 11, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant