fix: canonicalize browser navigation after commit

This commit is contained in:
Codex
2026-07-30 22:35:37 +08:00
parent 95abd09c39
commit 9bc0f27f12
4 changed files with 103 additions and 16 deletions
+7 -2
View File
@@ -3,15 +3,20 @@ import { createRoot } from 'react-dom/client';
import 'animal-island-ui/style';
import { ConsoleAuthGate } from './auth/console-auth.js';
import { AppShell } from './app-shell.js';
import { AppShell, resolveRoute } from './app-shell.js';
import { useBrowserPathname } from './navigation/use-browser-pathname.js';
import './styles.css';
const root = document.querySelector<HTMLElement>('#root');
if (!root) throw new Error('Missing application root');
function resolveBrowserPathname(pathname: string): string {
const route = resolveRoute(pathname);
return route.kind === 'redirect' ? (route.to ?? pathname) : pathname;
}
function BrowserApp() {
const pathname = useBrowserPathname();
const pathname = useBrowserPathname(resolveBrowserPathname);
return (
<ConsoleAuthGate>
<AppShell pathname={pathname} />