From b1d0f3c1faf634c69fb41ae7a692cde2cfcf4503 Mon Sep 17 00:00:00 2001 From: Sergei Lebedev Date: Wed, 24 Aug 2016 17:42:25 +0300 Subject: [PATCH] Fixed a bug in 'ConfigWithDefaults.get_sync' The method returned the default value if the result of '_class_data' lookup was falsy (in the JS sense). This bug also affected 'ConfigWithDefaults.get'. --- notebook/static/services/config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notebook/static/services/config.js b/notebook/static/services/config.js index a4a207c9d..9c5d7dda8 100644 --- a/notebook/static/services/config.js +++ b/notebook/static/services/config.js @@ -92,7 +92,7 @@ function(utils) { ConfigWithDefaults.prototype.get = function(key) { var that = this; return this.section.loaded.then(function() { - return that._class_data()[key] || that.defaults[key]; + return that.get_sync(key); }); }; @@ -101,7 +101,8 @@ function(utils) { * instead of waiting for it to load. */ ConfigWithDefaults.prototype.get_sync = function(key) { - return this._class_data()[key] || this.defaults[key]; + var data = this._class_data(); + return key in data ? data[key] : this.defaults[key]; }; /**