Dashboard scenes: fix textbox value only set to first character of default value (#86595)

Dashboard scene: fix textbox value only set to first character in default value
This commit is contained in:
Oscar Kilhed 2024-04-23 06:52:26 +02:00 committed by GitHub
parent 357276da01
commit dccad4e081
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -392,9 +392,20 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode
hide: variable.hide,
});
} else if (variable.type === 'textbox') {
let val;
if (!variable?.current?.value) {
val = variable.query;
} else {
if (typeof variable.current.value === 'string') {
val = variable.current.value;
} else {
val = variable.current.value[0];
}
}
return new TextBoxVariable({
...commonProperties,
value: variable?.current?.value?.[0] ?? variable.query,
value: val,
skipUrlSync: variable.skipUrlSync,
hide: variable.hide,
});