website refactor
This commit is contained in:
@@ -8,11 +8,10 @@ import { ApiError } from '../api/base/ApiError';
|
||||
import { connectionMonitor } from '../api/base/ApiConnectionMonitor';
|
||||
|
||||
// Import notification system (will be used if available)
|
||||
let notificationSystem: any = null;
|
||||
try {
|
||||
// Dynamically import to avoid circular dependencies
|
||||
import('@/components/notifications/NotificationProvider').then(module => {
|
||||
notificationSystem = module;
|
||||
import('@/components/notifications/NotificationProvider').then(_module => {
|
||||
// Notification system available
|
||||
}).catch(() => {
|
||||
// Notification system not available yet
|
||||
});
|
||||
|
||||
@@ -48,7 +48,6 @@ export class ErrorReplaySystem {
|
||||
* Capture current state for replay
|
||||
*/
|
||||
captureReplay(error: Error | ApiError, additionalContext: Record<string, unknown> = {}): ReplayContext {
|
||||
const globalHandler = getGlobalErrorHandler();
|
||||
const apiLogger = getGlobalApiLogger();
|
||||
|
||||
const replayId = `replay_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
||||
|
||||
@@ -230,7 +230,7 @@ export class GlobalErrorHandler {
|
||||
private setupReactErrorHandling(): void {
|
||||
// This will be used by React Error Boundaries
|
||||
// We'll provide a global registry for React errors
|
||||
(window as any).__GRIDPILOT_REACT_ERRORS__ = [];
|
||||
(window as { __GRIDPILOT_REACT_ERRORS__?: unknown[] }).__GRIDPILOT_REACT_ERRORS__ = [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,14 +254,14 @@ export class GlobalErrorHandler {
|
||||
width: window.screen.width,
|
||||
height: window.screen.height,
|
||||
},
|
||||
memory: (performance as any).memory ? {
|
||||
usedJSHeapSize: (performance as any).memory.usedJSHeapSize,
|
||||
totalJSHeapSize: (performance as any).memory.totalJSHeapSize,
|
||||
memory: (performance as unknown as { memory?: { usedJSHeapSize: number; totalJSHeapSize: number } }).memory ? {
|
||||
usedJSHeapSize: (performance as unknown as { memory: { usedJSHeapSize: number; totalJSHeapSize: number } }).memory.usedJSHeapSize,
|
||||
totalJSHeapSize: (performance as unknown as { memory: { usedJSHeapSize: number; totalJSHeapSize: number } }).memory.totalJSHeapSize,
|
||||
} : null,
|
||||
connection: (navigator as any).connection ? {
|
||||
effectiveType: (navigator as any).connection.effectiveType,
|
||||
downlink: (navigator as any).connection.downlink,
|
||||
rtt: (navigator as any).connection.rtt,
|
||||
connection: (navigator as unknown as { connection?: { effectiveType: string; downlink: number; rtt: number } }).connection ? {
|
||||
effectiveType: (navigator as unknown as { connection: { effectiveType: string; downlink: number; rtt: number } }).connection.effectiveType,
|
||||
downlink: (navigator as unknown as { connection: { effectiveType: string; downlink: number; rtt: number } }).connection.downlink,
|
||||
rtt: (navigator as unknown as { connection: { effectiveType: string; downlink: number; rtt: number } }).connection.rtt,
|
||||
} : null,
|
||||
...additionalContext,
|
||||
enhancedStack: this.options.captureEnhancedStacks ? this.enhanceStackTrace(stack) : undefined,
|
||||
@@ -467,8 +467,8 @@ export class GlobalErrorHandler {
|
||||
window.removeEventListener('unhandledrejection', this.handleUnhandledRejection);
|
||||
|
||||
// Restore original console.error
|
||||
if ((console as any)._originalError) {
|
||||
console.error = (console as any)._originalError;
|
||||
if ((console as unknown as { _originalError?: typeof console.error })._originalError) {
|
||||
console.error = (console as unknown as { _originalError: typeof console.error })._originalError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ export class ConsoleLogger implements Logger {
|
||||
|
||||
if (supportsGrouping) {
|
||||
// Safe to call - we've verified both functions exist
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(console as any).groupCollapsed(`%c${emoji} [${source.toUpperCase()}] ${prefix}: ${message}`, `color: ${color}; font-weight: bold;`);
|
||||
} else {
|
||||
// Simple format for edge runtime
|
||||
@@ -73,6 +74,7 @@ export class ConsoleLogger implements Logger {
|
||||
|
||||
if (supportsGrouping) {
|
||||
// Safe to call - we've verified the function exists
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(console as any).groupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user