rerun complete

This commit is contained in:
Boki 2025-07-04 18:14:44 -04:00
parent 11c6c19628
commit d15e542f20
17 changed files with 4694 additions and 146 deletions

View file

@ -0,0 +1,47 @@
// Global error handler for chart disposal errors
export function setupChartErrorHandler() {
// Only suppress chart disposal errors during page unload
let isUnloading = false;
window.addEventListener('beforeunload', () => {
isUnloading = true;
});
window.addEventListener('unload', () => {
isUnloading = true;
});
// Intercept console errors for chart disposal
const originalError = console.error;
console.error = (...args) => {
// Check if this is a chart disposal error during unload
if (isUnloading) {
const errorStr = args.join(' ');
if (errorStr.includes('Object is disposed') ||
errorStr.includes('Cannot read properties of null') ||
errorStr.includes('lightweight-charts')) {
// Suppress the error during unload
return;
}
}
// Otherwise, log normally
originalError.apply(console, args);
};
// Also catch unhandled errors
window.addEventListener('error', (event) => {
if (isUnloading && event.error?.message?.includes('Object is disposed')) {
event.preventDefault();
return;
}
});
// Catch unhandled promise rejections
window.addEventListener('unhandledrejection', (event) => {
if (isUnloading && event.reason?.message?.includes('Object is disposed')) {
event.preventDefault();
return;
}
});
}