advanced syntaxes (VAR{}): avoid storing default value as string if it can be parsed as a javascript primitive (boolean, number, etc)

This commit is contained in:
bordun 2021-05-08 16:02:18 +02:00
parent e98f270690
commit 15b52a5d25
2 changed files with 7 additions and 0 deletions

View file

@ -638,6 +638,12 @@ class Widget extends EventEmitter {
return typeof variables[m] === 'string' ? variables[m] : JSON.stringify(variables[m])
}))
if (typeof value === 'string' && isJSON(value)) {
try {
value = JSON.parseFlex(value)
} catch (err) {}
}
if (!this.variables[name]) {
this.variables[name] = {default: value, value: value, propNames: [propName]}