dashboard-v2 fix: wouter Router base = /clawstor
Build with clawstor cache / Cargo build (clawstor-cached) (pull_request) Successful in 17s

Bare <Link href='/'> was navigating to tailnet root =
OpenClaw (which mounts /). Wrap App in <Router base=...>
detected from window.location so links + route matching
prefix the mount path. Falls back to no-base for local
:7700/v2/ dev too.
This commit is contained in:
Omar Sobh
2026-07-14 17:04:52 -07:00
parent b672037e42
commit e63f25c560
2 changed files with 39 additions and 2 deletions
+18 -1
View File
@@ -1,10 +1,27 @@
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Route, Switch, Link, useLocation } from 'wouter';
import { Route, Switch, Link, Router, useLocation } from 'wouter';
import { CommandCenter } from './pages/CommandCenter';
import { NodeDetail } from './pages/NodeDetail';
import { StorageBrowser } from './pages/StorageBrowser';
import { RefTrackingPage } from './pages/RefTrackingPage';
// Base path — matches the deploy mount. When served locally at
// :7700/v2/ the base is /v2; via Tailscale it's /clawstor.
// Detected from the browser's current pathname so a single SPA
// build works both places without env-var wiring.
const BASE = (() => {
if (typeof window === 'undefined')
return '';
const p = window.location.pathname;
if (p === '/clawstor' || p.startsWith('/clawstor/'))
return '/clawstor';
if (p === '/v2' || p.startsWith('/v2/'))
return '/v2';
return '';
})();
export default function App() {
return (_jsx(Router, { base: BASE, children: _jsx(Shell, {}) }));
}
function Shell() {
const [loc] = useLocation();
const tab = (path, label) => {
const active = loc === path || (path !== '/' && loc.startsWith(path));