forked from jsnbuchanan/crowd-funder-for-time-pwa
# Commit Message for SharedArrayBuffer Platform Exclusion
fix: eliminate SharedArrayBuffer checks on non-web platforms * Add platform guard in AbsurdSqlDatabaseService to only initialize on web * Change singleton pattern from eager to lazy instantiation * Update worker import to use lazy singleton pattern * Prevents absurd-sql initialization on Electron/Capacitor platforms * Reduces console noise and memory footprint on desktop/mobile * Maintains full web platform functionality and performance Resolves SharedArrayBuffer-related console output on Electron platform while preserving all web features and maintaining clean architecture.
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import { initializeApp } from "./main.common";
|
||||
// import { logger } from "./utils/logger"; // DISABLED FOR DEBUGGING
|
||||
import { logger } from "./utils/logger";
|
||||
|
||||
const platform = process.env.VITE_PLATFORM;
|
||||
const pwa_enabled = process.env.VITE_PWA_ENABLED === "true";
|
||||
|
||||
// Debug: Check SharedArrayBuffer availability
|
||||
console.log(
|
||||
`[SharedArrayBuffer] Available: ${typeof SharedArrayBuffer !== "undefined"}`,
|
||||
);
|
||||
console.log(`[Browser] User Agent: ${navigator.userAgent}`);
|
||||
console.log(
|
||||
`[Headers] Check COOP/COEP in Network tab if SharedArrayBuffer is false`,
|
||||
);
|
||||
// Only log SharedArrayBuffer info for web platform in development
|
||||
if (platform === "web" && process.env.NODE_ENV !== "production") {
|
||||
logger.debug(
|
||||
`[SharedArrayBuffer] Available: ${typeof SharedArrayBuffer !== "undefined"}`,
|
||||
);
|
||||
logger.debug(`[Browser] User Agent: ${navigator.userAgent}`);
|
||||
logger.debug(
|
||||
`[Headers] Check COOP/COEP in Network tab if SharedArrayBuffer is false`,
|
||||
);
|
||||
}
|
||||
|
||||
// Only import service worker for web builds
|
||||
if (pwa_enabled) {
|
||||
@@ -23,15 +25,11 @@ const app = initializeApp();
|
||||
// Note: Worker initialization is now handled by WebPlatformService
|
||||
// This ensures single-point database access and prevents double migrations
|
||||
if (platform === "web" || platform === "development") {
|
||||
// logger.log( // DISABLED
|
||||
// "[Web] Database initialization will be handled by WebPlatformService",
|
||||
// );
|
||||
console.log(
|
||||
logger.debug(
|
||||
"[Web] Database initialization will be handled by WebPlatformService",
|
||||
);
|
||||
} else {
|
||||
// logger.warn("[Web] SQL not initialized for platform", { platform }); // DISABLED
|
||||
console.warn("[Web] SQL not initialized for platform", { platform });
|
||||
logger.debug("[Web] SQL not initialized for platform", { platform });
|
||||
}
|
||||
|
||||
app.mount("#app");
|
||||
|
||||
Reference in New Issue
Block a user