🎯 Use case
This file lives under “hooks/”, which covers reusable UI or integration hooks. On the API surface it exposes mergeClients and useMergedClients — mainly functions, hooks, or classes. Dependencies touch lodash-es and React UI. It composes internal code from services (relative imports).
Generated from folder role, exports, dependency roots, and inline comments — not hand-reviewed for every path.
🧠 Inline summary
import uniqBy from 'lodash-es/uniqBy.js' import { useMemo } from 'react' import type { MCPServerConnection } from '../services/mcp/types.js' export function mergeClients(
📤 Exports (heuristic)
mergeClientsuseMergedClients
📚 External import roots
Package roots from from "…" (relative paths omitted).
lodash-esreact
🖥️ Source preview
import uniqBy from 'lodash-es/uniqBy.js'
import { useMemo } from 'react'
import type { MCPServerConnection } from '../services/mcp/types.js'
export function mergeClients(
initialClients: MCPServerConnection[] | undefined,
mcpClients: readonly MCPServerConnection[] | undefined,
): MCPServerConnection[] {
if (initialClients && mcpClients && mcpClients.length > 0) {
return uniqBy([...initialClients, ...mcpClients], 'name')
}
return initialClients || []
}
export function useMergedClients(
initialClients: MCPServerConnection[] | undefined,
mcpClients: MCPServerConnection[] | undefined,
): MCPServerConnection[] {
return useMemo(
() => mergeClients(initialClients, mcpClients),
[initialClients, mcpClients],
)
}