diff --git a/web/src/routes/about/index.tsx b/web/src/routes/about/index.tsx index 29ea2a555..0849d9fec 100644 --- a/web/src/routes/about/index.tsx +++ b/web/src/routes/about/index.tsx @@ -16,10 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { createFileRoute } from '@tanstack/react-router' +import { createFileRoute, redirect } from '@tanstack/react-router' import { About } from '@/features/about' export const Route = createFileRoute('/about/')({ + // CodaAPI patch (coda/patches/0001-console-home-to-portal.patch): the portal + // also serves /about; see the same guard in routes/index.tsx. + beforeLoad: ({ location }) => { + const documentUrl = performance.getEntriesByType('navigation')[0]?.name + if (documentUrl && new URL(documentUrl).pathname !== location.pathname) { + throw redirect({ href: location.href, reloadDocument: true }) + } + }, component: About, }) diff --git a/web/src/routes/index.tsx b/web/src/routes/index.tsx index 1fe03393d..18f8a2514 100644 --- a/web/src/routes/index.tsx +++ b/web/src/routes/index.tsx @@ -16,10 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { createFileRoute } from '@tanstack/react-router' +import { createFileRoute, redirect } from '@tanstack/react-router' import { Home } from '@/features/home' export const Route = createFileRoute('/')({ + // CodaAPI patch (coda/patches/0001-console-home-to-portal.patch): the CodaAPI + // deployment serves its portal at this path, so navigating here inside the + // console reloads the page and lets the server answer. A document that was + // itself loaded at this path got the console from the server (no portal in + // front), so it renders the upstream page as usual. + beforeLoad: ({ location }) => { + const documentUrl = performance.getEntriesByType('navigation')[0]?.name + if (documentUrl && new URL(documentUrl).pathname !== location.pathname) { + throw redirect({ href: location.href, reloadDocument: true }) + } + }, component: Home, })