[v11.0.x] Dashboard scenes: fix textbox value only set to first character of default value (#86742)

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

(cherry picked from commit dccad4e081)

Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-04-23 07:10:41 +02:00
committed by GitHub
co-authored by Oscar Kilhed
parent 8979111ec0
commit 831c717689
@@ -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,
});