Skip to content

The agent that grows with you

fix(desktop): directory tile click type-checks

alt-glitch2b50c8c5c816
diff --git a/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx b/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx
index cb1aeadeb1e..35d9b2f2c91 100644
--- a/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx
+++ b/apps/desktop/src/components/assistant-ui/connector-directory-card.tsx
@@ -158,16 +158,19 @@ function DirectoryBody({ onContinue, owner, returnRoute, suggested = NO_SUGGESTI
// Failed: the same request again. Waiting: the link again. Otherwise the app's own verb.
const press = (card: ConnectorCardModel, open: AccountOperation | null) => {
- if (open && retryable(open)) {
- actions.retry(card, open)
- } else if (open) {
- const url = open.targets.find(target => target.connectUrl)?.connectUrl
-
- if (url) {
- void window.hermesDesktop?.openExternal?.(url)
- }
- } else {
+ if (!open) {
actions.runHostedVerb(card)
+
+ return
+ }
+
+ // Read before `retryable`: its type guard narrows `open` to never on the false branch.
+ const url = open.targets.find(target => target.connectUrl)?.connectUrl
+
+ if (retryable(open)) {
+ actions.retry(card, open)
+ } else if (url) {
+ void window.hermesDesktop?.openExternal?.(url)
}
}