diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 7709c1d..7612984 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -389,6 +389,7 @@ function SshHostsSection() { const [newDrafts, setNewDrafts] = useState<{ key: number; values: Record }[]>([]) const nextNewKey = useRef(-1) const fileInputRefs = useRef>({}) + const collapseInitialized = useRef(false) function toggleCollapsed(id: number) { setCollapsed((prev) => { @@ -404,7 +405,14 @@ function SshHostsSection() { }, []) function refresh() { - api.listIntegrations().then(({ integrations }) => setHosts(integrations.filter((i) => i.type === 'ssh'))) + api.listIntegrations().then(({ integrations }) => { + const sshHosts = integrations.filter((i) => i.type === 'ssh') + setHosts(sshHosts) + if (!collapseInitialized.current) { + collapseInitialized.current = true + setCollapsed(new Set(sshHosts.filter((h) => h.secretKeys.length > 0).map((h) => h.id))) + } + }) } function toggleReveal(key: string) {