Skip to content

Commit

Permalink
Merge pull request #5642 from JohnJohnsonIII/master
Browse files Browse the repository at this point in the history
Fix issue #5452 by putting in checks into the _changeCallback functio…
  • Loading branch information
ian-r-rose committed Nov 19, 2018
2 parents bd47dbd + c164b41 commit 9fa8616
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/docregistry/src/mimedocument.ts
Expand Up @@ -11,7 +11,7 @@ import {
MimeModel
} from '@jupyterlab/rendermime';

import { JSONObject, PromiseDelegate } from '@phosphor/coreutils';
import { JSONObject, PromiseDelegate, JSONExt } from '@phosphor/coreutils';

import { Message, MessageLoop } from '@phosphor/messaging';

Expand Down Expand Up @@ -165,9 +165,13 @@ export class MimeContent extends Widget {
}
let data = options.data[this.mimeType];
if (typeof data === 'string') {
this._context.model.fromString(data);
if (data !== this._context.model.toString()) {
this._context.model.fromString(data);
}
} else {
this._context.model.fromJSON(data);
if (!JSONExt.deepEqual(data, this._context.model.toJSON())) {
this._context.model.fromJSON(data);
}
}
};

Expand Down

0 comments on commit 9fa8616

Please sign in to comment.