fix(dashboard): add cache-busting and defensive chartManager guards to fix empty charts
This commit is contained in:
@@ -88,3 +88,15 @@ class ApiClient {
|
||||
}
|
||||
|
||||
window.api = new ApiClient();
|
||||
|
||||
// Helper: waits until chartManager is available (defensive against load-order edge cases)
|
||||
window.waitForChartManager = async (timeoutMs = 3000) => {
|
||||
if (window.chartManager) return window.chartManager;
|
||||
const start = Date.now();
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
await new Promise(r => setTimeout(r, 50));
|
||||
if (window.chartManager) return window.chartManager;
|
||||
}
|
||||
console.warn('chartManager not available after', timeoutMs, 'ms');
|
||||
return null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user