mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
if select has multiple, make init value an array (#17868)
if multiple, make it an array
This commit is contained in:
parent
0276430ab5
commit
eae4ca1271
@ -61,8 +61,10 @@ export const computeInitialHaFormData = (
|
|||||||
data[field.name] = selector.number?.min ?? 0;
|
data[field.name] = selector.number?.min ?? 0;
|
||||||
} else if ("select" in selector) {
|
} else if ("select" in selector) {
|
||||||
if (selector.select?.options.length) {
|
if (selector.select?.options.length) {
|
||||||
const val = selector.select.options[0];
|
const firstOption = selector.select.options[0];
|
||||||
data[field.name] = typeof val === "string" ? val : val.value;
|
const val =
|
||||||
|
typeof firstOption === "string" ? firstOption : firstOption.value;
|
||||||
|
data[field.name] = selector.select.multiple ? [val] : val;
|
||||||
}
|
}
|
||||||
} else if ("duration" in selector) {
|
} else if ("duration" in selector) {
|
||||||
data[field.name] = {
|
data[field.name] = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user