Skip to content

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

fix(frontend): fix condition values not showing in Custom Approval edit modal (#18210)

p0nyc13a6f78c507
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue
index fcf6a6ad4e..a40b1ab5be 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue
@@ -135,22 +135,23 @@ const allowSave = computed(() => {
});
const resolveLocalState = async () => {
+ // Reset to empty state immediately to unmount old Condition components.
+ // This prevents component reuse issues when switching between rules,
+ // where the ValueInput watch would reset values when factor/operator changes.
+ state.conditionExpr = wrapAsGroup(emptySimpleExpr());
+ state.flow = createProto(ApprovalFlowSchema, { roles: [] });
+
if (props.rule) {
- let expr: ConditionGroupExpr = wrapAsGroup(emptySimpleExpr());
if (props.rule.condition) {
const parsedExprs = await batchConvertCELStringToParsedExpr([
props.rule.condition,
]);
const celExpr = head(parsedExprs);
if (celExpr) {
- expr = wrapAsGroup(resolveCELExpr(celExpr));
+ state.conditionExpr = wrapAsGroup(resolveCELExpr(celExpr));
}
}
- state.conditionExpr = expr;
state.flow = cloneDeep(props.rule.flow);
- } else {
- state.conditionExpr = wrapAsGroup(emptySimpleExpr());
- state.flow = createProto(ApprovalFlowSchema, { roles: [] });
}
};
diff --git a/frontend/src/components/ExprEditor/components/MultiSelect.vue b/frontend/src/components/ExprEditor/components/MultiSelect.vue
index 54d74265bf..2b108ad6f6 100644
--- a/frontend/src/components/ExprEditor/components/MultiSelect.vue
+++ b/frontend/src/components/ExprEditor/components/MultiSelect.vue
@@ -84,7 +84,8 @@ const toggleCheckAll = (on: boolean) => {
}
};
-const handleSearch = useDebounceFn(async (search: string) => {
+// Non-debounced function for initial load
+const loadOptions = async (search: string) => {
if (!optionConfig.value.search) {
state.rawOptionList = [...optionConfig.value.options];
return;
@@ -97,12 +98,17 @@ const handleSearch = useDebounceFn(async (search: string) => {
} finally {
state.loading = false;
}
-}, DEBOUNCE_SEARCH_DELAY);
+};
+
+// Debounced version for user-typed searches
+const handleSearch = useDebounceFn(loadOptions, DEBOUNCE_SEARCH_DELAY);
watch(
() => factor.value,
async () => {
- await handleSearch("");
+ // Use non-debounced loadOptions for initial load to ensure options
+ // are available immediately when the component renders
+ await loadOptions("");
// valid initial value.
const search = optionConfig.value.search;
if (!search) {
diff --git a/frontend/src/components/ExprEditor/components/SingleSelect.vue b/frontend/src/components/ExprEditor/components/SingleSelect.vue
index 3b7cb9597c..6c05a40a7d 100644
--- a/frontend/src/components/ExprEditor/components/SingleSelect.vue
+++ b/frontend/src/components/ExprEditor/components/SingleSelect.vue
@@ -48,7 +48,8 @@ const state = reactive<LocalState>({
const { optionConfig, factor } = useSelectOptionConfig(toRef(props, "expr"));
-const handleSearch = useDebounceFn(async (search: string) => {
+// Non-debounced function for initial load
+const loadOptions = async (search: string) => {
if (!optionConfig.value.search) {
state.rawOptionList = [...optionConfig.value.options];
return;
@@ -61,12 +62,17 @@ const handleSearch = useDebounceFn(async (search: string) => {
} finally {
state.loading = false;
}
-}, DEBOUNCE_SEARCH_DELAY);
+};
+
+// Debounced version for user-typed searches
+const handleSearch = useDebounceFn(loadOptions, DEBOUNCE_SEARCH_DELAY);
watch(
() => factor.value,
async () => {
- await handleSearch("");
+ // Use non-debounced loadOptions for initial load to ensure options
+ // are available immediately when the component renders
+ await loadOptions("");
const search = optionConfig.value.search;
if (!search) {
return;