forked from jsnbuchanan/crowd-funder-for-time-pwa
Fix circular dependency in logging during initialization
- Add initialization phase detection to logger (2-second delay) - Prevent database logging during critical startup phase - Use console logging for critical startup messages to avoid circular dependency - Add manual initialization control functions (markInitializationComplete, isInitializationPhase) - Filter initialization-related messages from database logging Files modified: - src/utils/logger.ts: Add initialization state tracking and filtering - src/registerSQLWorker.js: Use console for critical startup message - src/services/PlatformServiceFactory.ts: Use console for singleton creation message - src/services/platforms/WebPlatformService.ts: Use console for worker context message Resolves circular dependency where logging tried to access database during platform service initialization, causing infinite loops with [DB-PREVENTED-INFO] messages.
This commit is contained in:
@@ -97,7 +97,9 @@ export class WebPlatformService implements PlatformService {
|
||||
}
|
||||
} else {
|
||||
// We're in a worker context - skip initBackend call
|
||||
logger.log(
|
||||
// Use console for critical startup message to avoid circular dependency
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
"[WebPlatformService] Skipping initBackend call in worker context",
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user