Skip to content

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

fix: try to fix group select (#13315)

ecmadao8921b4523849
diff --git a/frontend/src/components/v2/Select/GroupSelect.vue b/frontend/src/components/v2/Select/GroupSelect.vue
index e14ff4a7e6..1056ef462a 100644
--- a/frontend/src/components/v2/Select/GroupSelect.vue
+++ b/frontend/src/components/v2/Select/GroupSelect.vue
@@ -1,7 +1,7 @@
<template>
<NSelect
:filterable="true"
- :value="value"
+ :value="validValue"
:options="options"
:disabled="disabled"
:clearable="clearable"
@@ -9,7 +9,7 @@
:filter="filterByTitle"
:render-label="renderLabel"
:render-tag="renderTag"
- :placeholder="'Select group'"
+ :placeholder="$t('project.members.select-groups')"
@update:value="$emit('update:value', $event)"
/>
</template>
@@ -59,6 +59,22 @@ const options = computed(() => {
}));
});
+const validValue = computed(() => {
+ if (!props.value) {
+ return props.value;
+ }
+ if (props.multiple) {
+ return (props.value as string[]).filter((v) => {
+ return options.value.findIndex((o) => o.value === v) >= 0;
+ });
+ }
+
+ if (options.value.findIndex((o) => o.value === props.value) >= 0) {
+ return props.value;
+ }
+ return undefined;
+});
+
const filterByTitle = (pattern: string, option: SelectOption) => {
const { group } = option as GroupSelectOption;
pattern = pattern.toLowerCase();