Skip to content

Commit

Permalink
Fix josdejong#781: race condition when destroying the editor right af…
Browse files Browse the repository at this point in the history
…ter setting data
  • Loading branch information
josdejong committed Sep 2, 2019
1 parent a78adf6 commit 671cad8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
https://github.com/josdejong/jsoneditor


## not yet published, version 7.0.2

- Fix #781: race condition when destroying the editor right after setting data.


## 2019-09-01, version 7.0.1

- Fix npm package missing `dist` folder.
Expand Down
8 changes: 4 additions & 4 deletions src/js/textmode.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,18 +711,18 @@ textmode._setText = function (jsonText, clearHistory) {
if (this.aceEditor) {
// prevent emitting onChange events while setting new text
this.onChangeDisabled = true

this.aceEditor.setValue(text, -1)
this.onChangeDisabled = false

if (clearHistory) {
// prevent initial undo action clearing the initial contents
const me = this
setTimeout(() => {
me.aceEditor.session.getUndoManager().reset()
if (me.aceEditor) {
me.aceEditor.session.getUndoManager().reset()
}
}, 0)
}

this.onChangeDisabled = false
}
// validate JSON schema
this._debouncedValidate()
Expand Down

0 comments on commit 671cad8

Please sign in to comment.