UCodeMirror: null values showing fixed
In UCodeMirror in code:
methods: {
updateValue (newVal) {
if (!this._codeMirror) return
let newValAsText = typeof newVal === 'object' ? JSON.stringify(newVal, null, 2) : newVal
if (newValAsText !== this.textValue) {
this.textValue = newValAsText
this._codeMirror.setValue(newValAsText)
}
},
in line let newValAsText = typeof newVal === 'object' ? JSON.stringify(newVal, null, 2) : newVal
If newVal
will be null
typeof null === 'object' => true
so we have
JSON.stringify(null, null, 2)
and null
value is shown instead of an empty string