From 1244c08e425ffa2094b1eb66af1db894dbe868e8 Mon Sep 17 00:00:00 2001 From: pptx704 Date: Sun, 3 May 2026 16:43:26 +0600 Subject: [PATCH] fix: fetch sandbox metrics immediately on page load Metrics data was only fetched after Chart.js dynamic import completed, leaving graphs empty until the first poll interval fired. Now loadMetrics() runs in parallel with the Chart.js import, and initCharts() resets the dedup key so pre-fetched data populates newly created chart instances. --- frontend/src/lib/components/MetricsPanel.svelte | 2 ++ frontend/src/routes/dashboard/capsules/[id]/+page.svelte | 2 ++ 2 files changed, 4 insertions(+) diff --git a/frontend/src/lib/components/MetricsPanel.svelte b/frontend/src/lib/components/MetricsPanel.svelte index 38a424d..826bbca 100644 --- a/frontend/src/lib/components/MetricsPanel.svelte +++ b/frontend/src/lib/components/MetricsPanel.svelte @@ -213,6 +213,7 @@ }, }); + lastDataKey = ''; updateCharts(); } @@ -233,6 +234,7 @@ onMount(async () => { if (!available) return; + loadMetrics(); const mod = await import('chart.js/auto'); ChartJS = mod.Chart; diff --git a/frontend/src/routes/dashboard/capsules/[id]/+page.svelte b/frontend/src/routes/dashboard/capsules/[id]/+page.svelte index a8bfb4d..f7bc6d4 100644 --- a/frontend/src/routes/dashboard/capsules/[id]/+page.svelte +++ b/frontend/src/routes/dashboard/capsules/[id]/+page.svelte @@ -333,6 +333,7 @@ }, }); + lastDataKey = ''; updateCharts(); } @@ -376,6 +377,7 @@ if (!metricsAvailable) return; + loadMetrics(); const mod = await import('chart.js/auto'); ChartJS = mod.Chart;