diff --git a/mathesar_ui/src/systems/connections/generalConnections.ts b/mathesar_ui/src/systems/connections/generalConnections.ts index 1fc238672e..b19601c676 100644 --- a/mathesar_ui/src/systems/connections/generalConnections.ts +++ b/mathesar_ui/src/systems/connections/generalConnections.ts @@ -51,41 +51,15 @@ export const generalConnections: Readable = derived( ], ); -// /** -// * The connection to pre-select when asking the user what connection they want -// * to utilize for managing other connections (e.g. creating a new connection). -// */ -// export const defaultGeneralConnection = derived( -// generalConnections, -// (connections) => { -// if (connections.length === 0) return undefined; -// const internalConnection = connections.find( -// (connection) => connection.type === 'internal_database', -// ); -// if (internalConnection) return internalConnection; -// const userDatabaseConnections = connections.filter( -// isUserDatabaseConnection, -// ); - -// // Return the connection with the highest ID -// return userDatabaseConnections.reduce((a, b) => -// a.connection.id > b.connection.id ? a : b, -// ); -// }, -// ); - export function pickDefaultGeneralConnection(connections: GeneralConnection[]) { if (connections.length === 0) return undefined; const internalConnection = connections.find( (connection) => connection.type === 'internal_database', ); if (internalConnection) return internalConnection; - const userDatabaseConnections = connections.filter(isUserDatabaseConnection); - - // Return the connection with the highest ID - return userDatabaseConnections.reduce((a, b) => - a.connection.id > b.connection.id ? a : b, - ); + return connections + .filter(isUserDatabaseConnection) + .reduce((a, b) => (a.connection.id > b.connection.id ? a : b)); } export function getUsername({ connection }: GeneralConnection): string {