Files
archived-orca/mobile/src/session/SessionDockPanelContent.tsx
Kelvin Amoaba 2ee151827a perf(mobile): load the terminal engine and the session dock only when needed (#40515)
* perf(mobile): load the terminal engine and the session dock only when needed

Opening a session parsed xterm (with its WebGL addon) and the wide-layout
dock's Source Control and Files panels, even for chat sessions on phones.
The page's terminal now imports its engine when the first terminal mounts,
and the dock lazy-loads its panels behind a frame that paints at once.

The page build anchors lazy modules that share boot code the way it already
anchors routes, so the new lazy chunks don't split the boot chunks.

* fix(mobile): show the terminal start error when replaying queued commands throws
2026-11-09 23:46:50 +00:00

45 lines
1.3 KiB
TypeScript

import { memo } from 'react'
import { MobileSourceControlRoutePanel } from '../source-control/MobileSourceControlRoutePanel'
import { MobileFileExplorerPanel } from '../files/MobileFileExplorerPanel'
import type { ActivePanel } from './session-panel-host'
export type SessionDockPanelContentProps = {
activePanel: Exclude<ActivePanel, null>
hostId: string
worktreeId: string
name: string
onRequestClose: () => void
}
// Width-independent panel props let memo skip content rerenders during resize.
export const SessionDockPanelContent = memo(function SessionDockPanelContent({
activePanel,
hostId,
worktreeId,
name,
onRequestClose
}: SessionDockPanelContentProps) {
// Reuse the source-control hub so dock icon switches retain commit draft, visited tabs and scroll.
if (activePanel === 'sourceControl' || activePanel === 'pr') {
return (
<MobileSourceControlRoutePanel
hostId={hostId}
worktreeId={worktreeId}
name={name}
embedded
initialTab={activePanel === 'pr' ? 'pr' : 'changes'}
onRequestClose={onRequestClose}
/>
)
}
return (
<MobileFileExplorerPanel
hostId={hostId}
worktreeId={worktreeId}
name={name}
embedded
onRequestClose={onRequestClose}
/>
)
})