The open source coding agent.
TypeScript
app: deduplicate allServers list
Brendan Alland62045553144
diff --git a/packages/app/src/components/dialog-select-server.tsx b/packages/app/src/components/dialog-select-server.tsxindex fa5d2d36c7a..76c8ff60ef0 100644--- a/packages/app/src/components/dialog-select-server.tsx+++ b/packages/app/src/components/dialog-select-server.tsx@@ -427,6 +427,7 @@ export function DialogSelectServer() {}>{(i) => {+ const key = ServerConnection.key(i)return (<div class="flex items-center gap-3 min-w-0 flex-1 group/item"><Show@@ -446,8 +447,8 @@ export function DialogSelectServer() {><ServerRowconn={i}- status={store.status[ServerConnection.key(i)]}- dimmed={store.status[ServerConnection.key(i)]?.healthy === false}+ status={store.status[key]}+ dimmed={store.status[key]?.healthy === false}class="flex items-center gap-3 px-4 min-w-0 flex-1"badge={<Show when={defaultUrl() === i.http.url}>@@ -460,7 +461,7 @@ export function DialogSelectServer() {</Show><Show when={store.editServer.id !== i.http.url}><div class="flex items-center justify-center gap-5 pl-4">- <Show when={current() === i}>+ <Show when={ServerConnection.key(current()) === key}><p class="text-text-weak text-12-regular">{language.t("dialog.server.current")}</p></Show>diff --git a/packages/app/src/context/server.tsx b/packages/app/src/context/server.tsxindex 336f8aa98cb..389371702eb 100644--- a/packages/app/src/context/server.tsx+++ b/packages/app/src/context/server.tsx@@ -102,15 +102,19 @@ export const { use: useServer, provider: ServerProvider } = createSimpleContext(}),)- const allServers = createMemo(- (): Array<ServerConnection.Any> => [+ const allServers = createMemo((): Array<ServerConnection.Any> => {+ const servers = [...(props.servers ?? []),...store.list.map((value) => ({type: "http" as const,http: typeof value === "string" ? { url: value } : value,})),- ],- )+ ]++ const deduped = new Map(servers.map((conn) => [ServerConnection.key(conn), conn]))++ return [...deduped.values()]+ })const [state, setState] = createStore({active: props.defaultServer,