diff --git a/frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx b/frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx index 990ee0790b..2a829bda68 100644 --- a/frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx +++ b/frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx @@ -20,6 +20,7 @@ import { Connection, ConnectionTypeConfigMapObj } from '~/concepts/connectionTyp import { filterEnabledConnectionTypes, getConnectionTypeDisplayName, + isConnection, } from '~/concepts/connectionTypes/utils'; import { useWatchConnectionTypes } from '~/utilities/useWatchConnectionTypes'; import { useNotebooksStates } from '~/pages/projects/notebook/useNotebooksStates'; @@ -264,12 +265,14 @@ export const ConnectionsFormSection: React.FC = ({ refreshProjectConnections(); } }} - onSubmit={(connection: Connection) => { - if (manageConnectionModal.isEdit) { - return replaceSecret(connection); + onSubmit={async (connection: Connection) => { + const response = manageConnectionModal.isEdit + ? await replaceSecret(connection) + : await createSecret(connection); + if (isConnection(response)) { + setSelectedConnections([...selectedConnections, response]); } - setSelectedConnections([...selectedConnections, connection]); - return createSecret(connection); + return response; }} isEdit={manageConnectionModal.isEdit} />