Merge pull request #1285 from nguyenbavinh-decathlon/bugfix/914_crash_app_when_set_env

fix(#914): Issue crash app when update environment variable
This commit is contained in:
Anoop M D 2023-12-27 21:26:28 +05:30 committed by GitHub
commit d6f6032c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,7 @@ class SingleLineEditor extends Component {
} }
}); });
} }
this.editor.setValue(this.props.value || ''); this.editor.setValue(String(this.props.value) || '');
this.editor.on('change', this._onEdit); this.editor.on('change', this._onEdit);
this.addOverlay(); this.addOverlay();
} }
@ -151,8 +151,8 @@ class SingleLineEditor extends Component {
this.editor.setOption('theme', this.props.theme === 'dark' ? 'monokai' : 'default'); this.editor.setOption('theme', this.props.theme === 'dark' ? 'monokai' : 'default');
} }
if (this.props.value !== prevProps.value && this.props.value !== this.cachedValue && this.editor) { if (this.props.value !== prevProps.value && this.props.value !== this.cachedValue && this.editor) {
this.cachedValue = this.props.value; this.cachedValue = String(this.props.value);
this.editor.setValue(this.props.value || ''); this.editor.setValue(String(this.props.value) || '');
} }
this.ignoreChangeEvent = false; this.ignoreChangeEvent = false;
} }