Skip to content

Commit ddff82f

Browse files
committed
Forcefully update the object since the editedInstance is still using
the old cert which will fail the getFormUpdates diff logic
1 parent 79ad21d commit ddff82f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

redisinsight/ui/src/pages/home/components/manual-connection/ManualConnectionWrapper.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,22 @@ const ManualConnectionWrapper = (props: Props) => {
207207
if (editMode) {
208208
database.id = editedInstance?.id
209209

210-
return getFormUpdates(database, omit(editedInstance, ['id']))
210+
const updatedValues = getFormUpdates(database, omit(editedInstance, ['id']))
211+
212+
// When a new caCert/clientCert is deleted, the editedInstance
213+
// is not updated with the deletion until 'apply' is
214+
// clicked. Once the apply is clicked, the editedInstance object
215+
// that is validated against, still has the older certificates
216+
// attached. Attaching the new certs to the final object helps.
217+
if (values.selectedCaCertName === 'ADD_NEW_CA_CERT' && values.newCaCertName !== '' && values.newCaCertName === editedInstance.caCert?.name) {
218+
updatedValues.caCert = database.caCert
219+
}
220+
221+
if (values.selectedTlsClientCertId === 'ADD_NEW' && values.newTlsCertPairName !== '' && values.selectedTlsClientCertName === editedInstance.newTlsCertPairName?.name) {
222+
updatedValues.clientCert = database.clientCert
223+
}
224+
225+
return updatedValues
211226
}
212227

213228
return removeEmpty(database)

0 commit comments

Comments
 (0)