fix: skip Tauri updater in Electron, add debug logging for routing
This commit is contained in:
@@ -5,8 +5,11 @@ import { trimTrailingSlash } from '../utils/common';
|
|||||||
|
|
||||||
const getClientConfig = async (): Promise<ClientConfig> => {
|
const getClientConfig = async (): Promise<ClientConfig> => {
|
||||||
const url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`;
|
const url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`;
|
||||||
|
console.log('[Config] Loading config from:', url);
|
||||||
const config = await fetch(url, { method: 'GET' });
|
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 = {
|
type ClientConfigLoaderProps = {
|
||||||
|
|||||||
@@ -73,6 +73,13 @@ export const createRouter = (clientConfig: ClientConfig, screenSize: ScreenSize)
|
|||||||
const { hashRouter } = clientConfig;
|
const { hashRouter } = clientConfig;
|
||||||
const mobile = screenSize === ScreenSize.Mobile;
|
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(
|
const routes = createRoutesFromElements(
|
||||||
<Route>
|
<Route>
|
||||||
<Route
|
<Route
|
||||||
@@ -295,8 +302,10 @@ export const createRouter = (clientConfig: ClientConfig, screenSize: ScreenSize)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (hashRouter?.enabled) {
|
if (hashRouter?.enabled) {
|
||||||
|
console.log('[Router] Using HashRouter with basename:', hashRouter.basename);
|
||||||
return createHashRouter(routes, { basename: hashRouter.basename });
|
return createHashRouter(routes, { basename: hashRouter.basename });
|
||||||
}
|
}
|
||||||
|
console.log('[Router] Using BrowserRouter with basename:', import.meta.env.BASE_URL);
|
||||||
return createBrowserRouter(routes, {
|
return createBrowserRouter(routes, {
|
||||||
basename: import.meta.env.BASE_URL,
|
basename: import.meta.env.BASE_URL,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -117,7 +117,14 @@ export const useLoginComplete = (data?: CustomLoginResponse) => {
|
|||||||
setFallbackSession(loginRes.access_token, loginRes.device_id, loginRes.user_id, loginBaseUrl);
|
setFallbackSession(loginRes.access_token, loginRes.device_id, loginRes.user_id, loginBaseUrl);
|
||||||
const afterLoginRedirectUrl = getAfterLoginRedirectPath();
|
const afterLoginRedirectUrl = getAfterLoginRedirectPath();
|
||||||
deleteAfterLoginRedirectPath();
|
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]);
|
}, [data, navigate]);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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
|
* Check for app updates using Tauri updater
|
||||||
* Prompts user if update is available and handles download/install
|
* 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() {
|
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
|
// Only run in Tauri context
|
||||||
if (!isTauri()) {
|
if (!isTauri()) {
|
||||||
console.log('Update check skipped - not running in Tauri');
|
console.log('Update check skipped - not running in Tauri');
|
||||||
|
|||||||
Reference in New Issue
Block a user