fix(frontend): open the more sheet on right-edge swipe in linked-server sessions

The swipe gate only matched local session URLs, which predates linked
servers, so the gesture never fired on /servers/<id>/sessions/<id>.
This commit is contained in:
Chris Scott committed 2026-10-21 23:28:01 -04:00
1 parent cbdd252d7a
commit 8d8960849e
3 files changed
+27 -3

No files matched your search

+2 -2
View File
@@ -35,7 +35,7 @@ import { SwipeNavigationProvider, useSwipeNavigation } from '@/contexts/SwipeNav
import { PermissionRequestDialog } from './components/session/PermissionRequestDialog'
import { SSHHostKeyDialog } from './components/ssh/SSHHostKeyDialog'
import { loginLoader, setupLoader, registerLoader, protectedLoader } from './lib/auth-loaders'
import { getSwipeBackTarget } from '@/lib/navigation'
import { getSwipeBackTarget, isSessionDetailRoute } from '@/lib/navigation'
import { onNotificationClick } from '@/lib/serviceWorker'
import { useAuth } from '@/hooks/useAuth'
import { useOpenCodeFailureToast } from '@/hooks/useOpenCodeFailureToast'
@@ -198,7 +198,7 @@ function AppShell() {
)
const canOpenMoreWithSwipe = () => {
return /^\/repos\/[^/]+\/sessions\/[^/]+$/.test(location.pathname) && !openSheet
return isSessionDetailRoute(location.pathname) && !openSheet
}
const { bind: bindMoreSwipe } = useRightEdgeSwipe(
+21 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { getSessionListPath, getSwipeBackTarget, getAssistantPath, getAssistantSessionListPath, isAssistantPath, getPathWithReturnTo, getReturnToPath, getRepoPath, getServerProjectPath, getServerSessionPath, getSessionPath, parseRepoRoute, parseServerProjectRoute, parseServerSessionRoute } from './navigation';
import { getSessionListPath, getSwipeBackTarget, getAssistantPath, getAssistantSessionListPath, isAssistantPath, getPathWithReturnTo, getReturnToPath, getRepoPath, getServerProjectPath, getServerSessionPath, getSessionPath, isSessionDetailRoute, parseRepoRoute, parseServerProjectRoute, parseServerSessionRoute } from './navigation';
describe('getAssistantPath', () => {
it('returns /assistant', () => {
@@ -206,6 +206,26 @@ describe('return target helpers', () => {
});
});
describe('isSessionDetailRoute', () => {
it('matches local session detail routes', () => {
expect(isSessionDetailRoute('/repos/42/sessions/abc')).toBe(true);
expect(isSessionDetailRoute('/repos/0/sessions/ses_assistant')).toBe(true);
});
it('matches linked server session detail routes', () => {
expect(isSessionDetailRoute('/servers/srv_kitchen/sessions/ses_abc')).toBe(true);
expect(isSessionDetailRoute('/servers/https%3A%2F%2Fhost/sessions/ses_abc')).toBe(true);
});
it('rejects everything else', () => {
expect(isSessionDetailRoute('/')).toBe(false);
expect(isSessionDetailRoute('/repos/42')).toBe(false);
expect(isSessionDetailRoute('/servers/srv_kitchen/projects')).toBe(false);
expect(isSessionDetailRoute('/servers/srv_kitchen/sessions')).toBe(false);
expect(isSessionDetailRoute('/assistant')).toBe(false);
});
});
describe('getSwipeBackTarget', () => {
describe('session detail routes', () => {
it('returns repo path for normal session detail', () => {
+4
View File
@@ -65,6 +65,10 @@ export function parseServerSessionRoute(pathname: string): { serverId: string; s
return { serverId, sessionId };
}
export function isSessionDetailRoute(pathname: string): boolean {
return /^\/repos\/[^/]+\/sessions\/[^/]+$/.test(pathname) || parseServerSessionRoute(pathname) !== null;
}
export function parseRepoRoute(pathname: string): { repoId: number | null; section: string | null; sessionId: string | null } {
const match = /^\/repos\/(\d+)(?:\/([^/]+)(?:\/([^/]+))?)?/.exec(pathname);
if (!match) {