From 0c28482de017487e9122790f717411c191a8cf13 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Fri, 9 Mar 2018 18:30:24 +0000 Subject: [PATCH] Fix going back to root directory with history in notebook list Bug found during pair programming with @mpacer --- notebook/static/tree/js/notebooklist.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 7f96b2bac..4312af213 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -102,6 +102,7 @@ define([ this.sessions = {}; this.base_url = options.base_url || utils.get_body_data("baseUrl"); this.notebook_path = options.notebook_path || utils.get_body_data("notebookPath"); + this.initial_notebook_path = this.notebook_path; this.contents = options.contents; if (this.session_list && this.session_list.events) { this.session_list.events.on('sessions_loaded.Dashboard', @@ -358,7 +359,8 @@ define([ var that = this; // Add an event handler browser back and forward events window.onpopstate = function(e) { - var path = window.history.state ? window.history.state.path : ''; + var path = (window.history.state && window.history.state.path) ? + window.history.state.path : that.initial_notebook_path; that.update_location(path); }; var breadcrumb = $('.breadcrumb');