Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: unset database environment (#18845)

ecmadao5066dcfa8cfb
diff --git a/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue b/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue
index cda83663da..5ebe8f1b46 100644
--- a/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue
+++ b/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue
@@ -68,7 +68,7 @@ const handleSelectEnvironment = async (name: string | undefined) => {
return;
}
const databasePatch = cloneDeep(props.database);
- databasePatch.environment = name;
+ databasePatch.environment = name ?? "";
await databaseStore.updateDatabase(
create(UpdateDatabaseRequestSchema, {
diff --git a/frontend/src/store/modules/v1/environment.ts b/frontend/src/store/modules/v1/environment.ts
index e765511df4..b87d4f3966 100644
--- a/frontend/src/store/modules/v1/environment.ts
+++ b/frontend/src/store/modules/v1/environment.ts
@@ -207,6 +207,9 @@ export const useEnvironmentV1Store = defineStore("environment_v1", {
return nullEnvironment();
}
const id = name.replace(environmentNamePrefix, "");
+ if (!id) {
+ return unknownEnvironment();
+ }
const environment =
this.environmentMapById.get(id) ?? unknownEnvironment();
if (!isValidEnvironmentName(environment.name) && fallback) {
diff --git a/frontend/src/types/v1/environment.ts b/frontend/src/types/v1/environment.ts
index b3cd2eeeda..23275a603c 100644
--- a/frontend/src/types/v1/environment.ts
+++ b/frontend/src/types/v1/environment.ts
@@ -43,7 +43,7 @@ export const nullEnvironment = (): Environment => {
export const isValidEnvironmentName = (name: unknown): name is string => {
return (
typeof name === "string" &&
- name.startsWith("environments/") &&
+ /^environments\/.+/.test(name) &&
name !== EMPTY_ENVIRONMENT_NAME &&
name !== UNKNOWN_ENVIRONMENT_NAME &&
name !== NULL_ENVIRONMENT_NAME