From 6a31ea64ed3ff0ac058a2699c4cdf60f19ff7a6d Mon Sep 17 00:00:00 2001 From: Litruv Date: Sat, 21 Feb 2026 19:54:00 +1100 Subject: [PATCH] fix: skip Tauri updater in Electron, add debug logging for routing --- src/app/components/ClientConfigLoader.tsx | 5 ++++- src/app/pages/Router.tsx | 9 +++++++++ src/app/pages/auth/login/loginUtil.ts | 9 ++++++++- src/index.tsx | 13 +++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/app/components/ClientConfigLoader.tsx b/src/app/components/ClientConfigLoader.tsx index 72d367c..1364c2c 100644 --- a/src/app/components/ClientConfigLoader.tsx +++ b/src/app/components/ClientConfigLoader.tsx @@ -5,8 +5,11 @@ import { trimTrailingSlash } from '../utils/common'; const getClientConfig = async (): Promise => { const url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`; + console.log('[Config] Loading config from:', url); const config = await fetch(url, { method: 'GET' }); - return config.json(); + const json = await config.json(); + console.log('[Config] Loaded config:', json); + return json; }; type ClientConfigLoaderProps = { diff --git a/src/app/pages/Router.tsx b/src/app/pages/Router.tsx index 18591f2..fc9ea1a 100644 --- a/src/app/pages/Router.tsx +++ b/src/app/pages/Router.tsx @@ -73,6 +73,13 @@ export const createRouter = (clientConfig: ClientConfig, screenSize: ScreenSize) const { hashRouter } = clientConfig; const mobile = screenSize === ScreenSize.Mobile; + console.log('[Router] Creating router:', { + hashRouter, + hashRouterEnabled: hashRouter?.enabled, + baseUrl: import.meta.env.BASE_URL, + locationHref: window.location.href, + }); + const routes = createRoutesFromElements( { setFallbackSession(loginRes.access_token, loginRes.device_id, loginRes.user_id, loginBaseUrl); const afterLoginRedirectUrl = getAfterLoginRedirectPath(); deleteAfterLoginRedirectPath(); - navigate(afterLoginRedirectUrl ?? getHomePath(), { replace: true }); + const targetPath = afterLoginRedirectUrl ?? getHomePath(); + console.log('[Login] Navigating after login:', { + targetPath, + afterLoginRedirectUrl, + homePath: getHomePath(), + currentLocation: window.location.href, + }); + navigate(targetPath, { replace: true }); } }, [data, navigate]); }; diff --git a/src/index.tsx b/src/index.tsx index 7011f3a..aafc620 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -42,11 +42,24 @@ if ('serviceWorker' in navigator) { }); } +/** + * Check if we're running in Electron (not Tauri) + * Electron exposes window.electron in preload.js + */ +const isElectron = (): boolean => 'electron' in window; + /** * Check for app updates using Tauri updater * Prompts user if update is available and handles download/install + * Note: Electron has its own auto-updater in main.js, so skip for Electron */ async function checkForUpdates() { + // Skip if in Electron - Electron has its own auto-updater + if (isElectron()) { + console.log('Update check skipped - Electron handles updates natively'); + return; + } + // Only run in Tauri context if (!isTauri()) { console.log('Update check skipped - not running in Tauri');