fix: prevent crash when removing last dropdown option in removeValue (#2843)

This commit is contained in:
Abdulazez (Abza)
2026-05-22 07:40:40 +03:00
committed by GitHub
parent 0a6b0452dc
commit 43fe558459
@@ -116,11 +116,12 @@ export const EditorFieldDropdownForm = ({
}
const newValues = [...currentValues];
const removedValue = currentValues[index].value;
newValues.splice(index, 1);
form.setValue('values', newValues);
if (form.getValues('defaultValue') === newValues[index].value) {
if (form.getValues('defaultValue') === removedValue) {
form.setValue('defaultValue', undefined);
}
};