Handle mobile RPC reconnect rejections

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo-H
2026-04-30 18:03:56 -04:00
co-authored by Orca
parent d0b03c6afa
commit 686d9f876a
2 changed files with 12 additions and 7 deletions
+10 -6
View File
@@ -499,9 +499,11 @@ export default function HostScreen() {
const openWorktreeSession = useCallback(
(item: Worktree) => {
if (client && connState === 'connected') {
void client.sendRequest('worktree.activate', {
worktree: `id:${item.worktreeId}`
})
void client
.sendRequest('worktree.activate', {
worktree: `id:${item.worktreeId}`
})
.catch(() => null)
}
router.push(
`/h/${hostId}/session/${encodeURIComponent(item.worktreeId)}?name=${encodeURIComponent(item.displayName || item.repo)}`
@@ -972,9 +974,11 @@ export default function HostScreen() {
onPress: () => {
if (client) {
setSleptIds((prev) => new Set(prev).add(actionTarget.worktreeId))
void client.sendRequest('worktree.sleep', {
worktree: `id:${actionTarget.worktreeId}`
})
void client
.sendRequest('worktree.sleep', {
worktree: `id:${actionTarget.worktreeId}`
})
.catch(() => null)
}
setActionTarget(null)
}
+2 -1
View File
@@ -264,9 +264,10 @@ export function connect(
}
function rejectAllPending(reason: string) {
const error = new Error(reason)
for (const [id, req] of pending) {
req.reject(new Error(reason))
pending.delete(id)
queueMicrotask(() => req.reject(error))
}
}