From 4a59d4896ff1920295fad18ba0c9ba520d207406 Mon Sep 17 00:00:00 2001 From: Mark L <73659136+liuxiaopai-ai@users.noreply.github.com> Date: Sat, 7 Feb 2026 22:33:08 +0800 Subject: [PATCH] fix: prevent /sessions/new from matching as dynamic sessionId route (#164) --- web/src/App.tsx | 2 +- web/src/router.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index 8eb0a543..1a038f6c 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -114,7 +114,7 @@ function AppInner() { }, [goBack, pathname]) const queryClient = useQueryClient() const sessionMatch = matchRoute({ to: '/sessions/$sessionId' }) - const selectedSessionId = sessionMatch ? sessionMatch.sessionId : null + const selectedSessionId = sessionMatch && sessionMatch.sessionId !== 'new' ? sessionMatch.sessionId : null const { isSyncing, startSync, endSync } = useSyncingState() const [sseDisconnected, setSseDisconnected] = useState(false) const syncTokenRef = useRef(0) diff --git a/web/src/router.tsx b/web/src/router.tsx index 018f7f83..0dd3ad15 100644 --- a/web/src/router.tsx +++ b/web/src/router.tsx @@ -108,7 +108,7 @@ function SessionsPage() { const projectCount = new Set(sessions.map(s => s.metadata?.worktree?.basePath ?? s.metadata?.path ?? 'Other')).size const sessionMatch = matchRoute({ to: '/sessions/$sessionId', fuzzy: true }) - const selectedSessionId = sessionMatch ? sessionMatch.sessionId : null + const selectedSessionId = sessionMatch && sessionMatch.sessionId !== 'new' ? sessionMatch.sessionId : null const isSessionsIndex = pathname === '/sessions' || pathname === '/sessions/' return (