diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/OptionsEditor/OptionsDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/OptionsEditor/OptionsDrawer.svelte
index 5fab1eaef4..340c1eb107 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/OptionsEditor/OptionsDrawer.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/OptionsEditor/OptionsDrawer.svelte
@@ -41,14 +41,12 @@
bind:value={option.label}
label="Label"
labelPosition="left"
- error={option.error?.label}
/>
{
- let hasError = false
+ const saveOptions = async () => {
+ // Filter out incomplete options, default if needed
+ tempValue = tempValue.filter(option => option.value || option.label)
for (let i = 0; i < tempValue.length; i++) {
let option = tempValue[i]
- if (!(option.label && option.value)) {
- option.error = {
- label: option.label ? undefined : "You must provide a label.",
- value: option.value ? undefined : "You must provide a value.",
- }
- tempValue[i] = option
- hasError = true
- }
- }
- if (!hasError) {
- drawer.hide()
+ option.label = option.label ? option.label : option.value
+ option.value = option.value ? option.value : option.label
+ tempValue[i] = option
}
dispatch("change", tempValue)
- }
-
- const clearOptionErrors = () => {
- for (let i = 0; i < tempValue.length; i++) {
- let option = tempValue[i]
- option.error = undefined
- tempValue[i] = option
- }
- }
-
- $: {
- for (let i = 0; i < tempValue.length; i++) {
- let option = tempValue[i]
- if (option.error?.label && option.label) {
- option.error.label = undefined
- }
- if (option.error?.value && option.value) {
- option.error.value = undefined
- }
- tempValue[i] = option
- }
+ drawer.hide()
}
- {
- clearOptionErrors()
- drawer.show()
- }}>Define Options
+Define Options
Define the options for this picker.
-
+