fix: revert getCurrentPathname regression and hide startup splash on web

getCurrentPathname used window.location.pathname instead of Expo Router's
pathname, which returns a file path on Electron — blocking navigation from
the index route. Also gate the bootstrap progress UI to desktop-only since
web has no local server to start/connect.
This commit is contained in:
Mohamed Boudra
2026-04-06 09:24:54 +07:00
parent dc772021a8
commit 5d09f7449e

View File

@@ -11,16 +11,10 @@ import {
useHosts,
} from "@/runtime/host-runtime";
import { buildHostRootRoute } from "@/utils/host-routes";
import { shouldUseDesktopDaemon } from "@/desktop/daemon/desktop-daemon";
const WELCOME_ROUTE = "/welcome";
function getCurrentPathname(fallbackPathname: string): string {
if (typeof window === "undefined") {
return fallbackPathname;
}
return window.location.pathname || fallbackPathname;
}
function useAnyOnlineHostServerId(serverIds: string[]): string | null {
const runtime = getHostRuntimeStore();
@@ -46,6 +40,8 @@ function useAnyOnlineHostServerId(serverIds: string[]): string | null {
);
}
const isDesktop = shouldUseDesktopDaemon();
export default function Index() {
const router = useRouter();
const pathname = usePathname();
@@ -58,8 +54,7 @@ export default function Index() {
if (!storeReady) {
return;
}
const currentPathname = getCurrentPathname(pathname);
if (currentPathname !== "/" && currentPathname !== "") {
if (pathname !== "/" && pathname !== "") {
return;
}
@@ -69,5 +64,5 @@ export default function Index() {
router.replace(targetRoute as any);
}, [anyOnlineServerId, pathname, router, storeReady]);
return <StartupSplashScreen bootstrapState={bootstrapState} />;
return <StartupSplashScreen bootstrapState={isDesktop ? bootstrapState : undefined} />;
}