From 36ab08523f49094bf38b779bddcd90fade6c4e94 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 25 Jan 2016 10:51:02 +0100 Subject: [PATCH] use _.isEqual to check for metadata changes JSON.stringifiy is unreliable because it is key-order sensitive --- notebook/static/notebook/js/notebook.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index a367d9558..3a722b587 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -8,6 +8,7 @@ define(function (require) { "use strict"; var IPython = require('base/js/namespace'); var $ = require('jquery'); + var _ = require('underscore'); var utils = require('base/js/utils'); var dialog = require('base/js/dialog'); var cellmod = require('notebook/js/cell'); @@ -245,7 +246,7 @@ define(function (require) { display_name: data.spec.display_name, language: data.spec.language, }; - if (!existing_spec || JSON.stringify(existing_spec) != JSON.stringify(that.metadata.kernelspec)) { + if (!existing_spec || ! _.isEqual(existing_spec, that.metadata.kernelspec)) { that.set_dirty(true); } // start session if the current session isn't already correct @@ -263,7 +264,7 @@ define(function (require) { var existing_info = that.metadata.language_info; var langinfo = kinfo.language_info; that.metadata.language_info = langinfo; - if (!existing_info || JSON.stringify(existing_info) != JSON.stringify(langinfo)) { + if (!existing_info || ! _.isEqual(existing_info, langinfo)) { that.set_dirty(true); } // Mode 'null' should be plain, unhighlighted text.