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
pull/76342/head
Oscar Kilhed 1 year ago committed by GitHub
parent 357276da01
commit dccad4e081
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts

@ -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,
});

Loading…
Cancel
Save