mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 00:03:59 +00:00
* refactor(mobile): split home modal and rpc client * fix(mobile): restore render-phase remount key in NewWorktreeModal The split moved the form-reset epoch from render-phase refs into useState + useLayoutEffect, which changed when the remount key is computed. On the render where visible flips false->true the key was still the old epoch, so the previous session's NewWorktreeModalContent rendered with visible === true carrying stale form state. Child layout effects run before the parent's, so visible-gated hooks (useNewWorkspaceRepositories, useNewWorktreeDrawerNavigation, useNewWorkspaceRuntimeContext) fired for that stale instance before the parent bumped the epoch and remounted. Restore the ref-based computation so the key is correct on the first render where visible flips true, keeping the composite open/client epoch semantics and the file split intact.
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { Pressable, Text, View } from 'react-native'
|
|
import type { WorkspaceSshGate } from '../tasks/workspace-ssh-gate'
|
|
import { workspaceSshStatusLabel } from '../tasks/workspace-ssh-gate'
|
|
import { newWorktreeFormStyles as styles } from './new-worktree-form-styles'
|
|
|
|
export function NewWorkspaceSshConnectionField({
|
|
repoName,
|
|
sshGate,
|
|
onConnect
|
|
}: {
|
|
repoName: string
|
|
sshGate: WorkspaceSshGate
|
|
onConnect: () => void
|
|
}) {
|
|
return (
|
|
<View style={styles.field}>
|
|
<Text style={styles.label}>SSH Connection</Text>
|
|
<View style={styles.sshBox}>
|
|
<View style={styles.sshRow}>
|
|
<View
|
|
style={[
|
|
styles.sshDot,
|
|
sshGate.status === 'connected'
|
|
? styles.sshDotConnected
|
|
: sshGate.connectInProgress
|
|
? styles.sshDotProgress
|
|
: styles.sshDotDisconnected
|
|
]}
|
|
/>
|
|
<View style={styles.sshCopy}>
|
|
<Text style={styles.sshTitle} numberOfLines={1}>
|
|
{repoName}
|
|
</Text>
|
|
<Text style={styles.sshSubtitle}>{workspaceSshStatusLabel(sshGate.status)}</Text>
|
|
</View>
|
|
{sshGate.status === 'connected' ? null : (
|
|
<Pressable
|
|
style={[styles.sshConnectButton, sshGate.connectInProgress && styles.disabled]}
|
|
disabled={sshGate.connectInProgress}
|
|
onPress={onConnect}
|
|
>
|
|
<Text style={styles.sshConnectText}>
|
|
{sshGate.connectInProgress ? 'Connecting...' : 'Connect'}
|
|
</Text>
|
|
</Pressable>
|
|
)}
|
|
</View>
|
|
{sshGate.error ? <Text style={styles.errorInline}>{sshGate.error}</Text> : null}
|
|
</View>
|
|
</View>
|
|
)
|
|
}
|