fix(mobile): serve the host index route on the hosted page

Shared session code exits to `/h/<hostId>` 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
This commit is contained in:
Jinwoo-H
2026-09-03 14:15:30 -04:00
parent 35a47e6333
commit 8bc82a6563
2 changed files with 24 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
// Why: shared session code leaves to `/h/<hostId>` (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'
@@ -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/<hostId>; 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'")
})
})