You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SelectMenu does not display the label associated to the falsy value "0":
The list is populated with both values:
The label associated to the truthy value "1" is displayed as expected:
Description
All falsy values are not displayed anymore since v2.20.0 due to the rework of the computed label in the SelectMenu component.
Here is the definition of this computed in /src/runtime/components/form/SelectMenu.vue:
const label = computed(() => {
if (!props.modelValue) return null
if (Array.isArray(props.modelValue) && props.modelValue.length) {
return `${props.modelValue.length} selected`
} else if (['string', 'number'].includes(typeof props.modelValue)) {
return props.valueAttribute ? accessor(selected.value, props.optionAttribute) : props.modelValue
}
return accessor(props.modelValue as Record<string, any>, props.optionAttribute)
})
The component should treat 0, "" and false as "acceptable" labelled values.
I believe the first condition should be either : if(props.modelValue == null) return null
Or: if(props.modelValue === null || props.modelValue === undefined) return null
Additional context
I will try to find some time to create a pull request if this is accepted as an issue. Not sure I can manage to do it short-term though.
Logs
The text was updated successfully, but these errors were encountered:
Environment
Version
v2.20.0
Reproduction
SelectMenu does not display the label associated to the falsy value "0":
The list is populated with both values:
The label associated to the truthy value "1" is displayed as expected:
Description
All falsy values are not displayed anymore since v2.20.0 due to the rework of the computed
label
in the SelectMenu component.Here is the definition of this computed in
/src/runtime/components/form/SelectMenu.vue
:The component should treat
0
,""
andfalse
as "acceptable" labelled values.I believe the first condition should be either :
if(props.modelValue == null) return null
Or:
if(props.modelValue === null || props.modelValue === undefined) return null
Additional context
I will try to find some time to create a pull request if this is accepted as an issue. Not sure I can manage to do it short-term though.
Logs
The text was updated successfully, but these errors were encountered: