forked from wrenn/wrenn
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.
This commit is contained in:
@ -213,6 +213,7 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lastDataKey = '';
|
||||||
updateCharts();
|
updateCharts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,6 +234,7 @@
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!available) return;
|
if (!available) return;
|
||||||
|
loadMetrics();
|
||||||
const mod = await import('chart.js/auto');
|
const mod = await import('chart.js/auto');
|
||||||
ChartJS = mod.Chart;
|
ChartJS = mod.Chart;
|
||||||
|
|
||||||
|
|||||||
@ -333,6 +333,7 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lastDataKey = '';
|
||||||
updateCharts();
|
updateCharts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,6 +377,7 @@
|
|||||||
|
|
||||||
if (!metricsAvailable) return;
|
if (!metricsAvailable) return;
|
||||||
|
|
||||||
|
loadMetrics();
|
||||||
const mod = await import('chart.js/auto');
|
const mod = await import('chart.js/auto');
|
||||||
ChartJS = mod.Chart;
|
ChartJS = mod.Chart;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user