fix: handle empty search path when editing connection param or when change is done using json edit (#8573)

This commit is contained in:
Pranav C
2024-05-25 06:29:55 +05:30
committed by GitHub
parent 543832e7a3
commit ef1997a7fe

View File

@@ -97,7 +97,8 @@ const validators = computed(() => {
'dataSource.connection.user': [fieldRequiredValidator()],
'dataSource.connection.password': [fieldRequiredValidator()],
'dataSource.connection.database': [fieldRequiredValidator()],
...([ClientType.PG, ClientType.MSSQL].includes(formState.value.dataSource.client)
...([ClientType.PG, ClientType.MSSQL].includes(formState.value.dataSource.client) &&
formState.value.dataSource.searchPath
? {
'dataSource.searchPath.0': [fieldRequiredValidator()],
}
@@ -342,6 +343,19 @@ onMounted(async () => {
updateSSLUse()
}
})
// if searchPath is null/undefined reset it to empty array when necessary
watch(
() => formState.value.dataSource.searchPath,
(val) => {
if ([ClientType.PG, ClientType.MSSQL].includes(formState.value.dataSource.client) && !val) {
formState.value.dataSource.searchPath = []
}
},
{
immediate: true,
},
)
</script>
<template>