From f5d70768c17d7e5399eec4c248c8319c7bfd1d1b Mon Sep 17 00:00:00 2001 From: Antti Kettunen Date: Sun, 26 Apr 2026 14:01:07 +0300 Subject: [PATCH] Redirect root to profile home - send / through the configured profile home page - keep the router regression test in sync with the redirect - preserve the legacy shell fallback for non-router bootstrap --- webui/src/app/router.test.tsx | 18 ++++++++++++++++++ webui/src/routes/index.tsx | 9 ++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/webui/src/app/router.test.tsx b/webui/src/app/router.test.tsx index b39cb553..72652b19 100644 --- a/webui/src/app/router.test.tsx +++ b/webui/src/app/router.test.tsx @@ -134,4 +134,22 @@ describe('createAppRouter', () => { expect(history.location.pathname).toBe('/discover'); }); + + it('redirects the root route to the profile home page', async () => { + window.SoulSyncWebShellBridge = createShellBridge({ + getProfileHomePage: vi.fn<() => ShellPageId>(() => 'search'), + }); + + const queryClient = createAppQueryClient(); + const history = createMemoryHistory({ initialEntries: ['/'] }); + const router = createAppRouter({ history, queryClient }); + + render(); + + await waitFor(() => { + expect(window.SoulSyncWebShellBridge?.activateLegacyPath).toHaveBeenCalledWith('/search'); + }); + + expect(history.location.pathname).toBe('/search'); + }); }); diff --git a/webui/src/routes/index.tsx b/webui/src/routes/index.tsx index 84aba6b4..8a6985b2 100644 --- a/webui/src/routes/index.tsx +++ b/webui/src/routes/index.tsx @@ -1,8 +1,15 @@ -import { createFileRoute } from '@tanstack/react-router'; +import { createFileRoute, redirect } from '@tanstack/react-router'; +import { getProfileHomePath } from '@/platform/shell/bridge'; import { LegacyRouteController } from '@/platform/shell/route-controllers'; export const Route = createFileRoute('/')({ + beforeLoad: ({ context }) => { + const bridge = context.platform.getShellBridge(); + if (!bridge) return; + + throw redirect({ href: getProfileHomePath(bridge), replace: true }); + }, component: IndexRouteComponent, });