Fix a race condition when switching language in the code app

This commit is contained in:
yflory
2018-01-09 12:44:25 +01:00
parent 65ccfe39ef
commit 77dcc1c705
2 changed files with 4 additions and 1 deletions

View File

@@ -313,6 +313,9 @@ define([
exp.contentUpdate = function (newContent) {
var oldDoc = canonicalize($textarea.val());
var remoteDoc = newContent.content;
// setValueAndCursor triggers onLocal, even if we don't make any change to the content
// and it may revert other changes (metadata)
if (oldDoc === remoteDoc) { return; }
exp.setValueAndCursor(oldDoc, remoteDoc);
};