From 8bc82a65631c41b7cc8387de632623dd46ea26d2 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Thu, 3 Sep 2026 14:15:30 -0400 Subject: [PATCH] fix(mobile): serve the host index route on the hosted page Shared session code exits to `/h/` when there is no history to pop (leaveSession after a fresh page load into a session, the missing-worktree bounce). The hosted page only listed workspaces at `/`, so those exits rendered expo-router's Unmatched Route screen. Alias the host index to the hosted list. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb --- mobile/host-web-app/h/[hostId]/index.tsx | 4 ++++ .../hosted-host-index-route.test.ts | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 mobile/host-web-app/h/[hostId]/index.tsx create mode 100644 mobile/src/mobile-web/hosted-host-index-route.test.ts diff --git a/mobile/host-web-app/h/[hostId]/index.tsx b/mobile/host-web-app/h/[hostId]/index.tsx new file mode 100644 index 00000000000..7ee025542bd --- /dev/null +++ b/mobile/host-web-app/h/[hostId]/index.tsx @@ -0,0 +1,4 @@ +// Why: shared session code leaves to `/h/` (leaveSession with no history, the +// missing-worktree bounce). The hosted page lists workspaces at `/`, so without this alias +// those exits landed on expo-router's Unmatched Route screen. +export { default } from '../../index' diff --git a/mobile/src/mobile-web/hosted-host-index-route.test.ts b/mobile/src/mobile-web/hosted-host-index-route.test.ts new file mode 100644 index 00000000000..a8350e8ab81 --- /dev/null +++ b/mobile/src/mobile-web/hosted-host-index-route.test.ts @@ -0,0 +1,20 @@ +import { existsSync, readFileSync } from 'node:fs' +import { describe, expect, it } from 'vitest' + +const hostedRoot = new URL('../../host-web-app/', import.meta.url) +const hostIndexRoute = new URL('h/[hostId]/index.tsx', hostedRoot) +const leaveSessionSource = readFileSync( + new URL('../session/use-mobile-session-markdown-actions.ts', import.meta.url), + 'utf8' +) +const bounceSource = readFileSync(new URL('../host-route-notice.ts', import.meta.url), 'utf8') + +describe('hosted host index route', () => { + it('serves the host index that shared session exits navigate to', () => { + // Both exits target /h/; a hosted page without that route renders Unmatched Route. + expect(leaveSessionSource).toContain('router.replace(`/h/${hostId}`)') + expect(bounceSource).toContain('`/h/${encodeURIComponent(hostId)}?notice=${notice}`') + expect(existsSync(hostIndexRoute)).toBe(true) + expect(readFileSync(hostIndexRoute, 'utf8')).toContain("export { default } from '../../index'") + }) +})