Skip to content

Commit 0c28482

Browse files
committed
Fix going back to root directory with history in notebook list
Bug found during pair programming with @mpacer
1 parent e321c80 commit 0c28482

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

notebook/static/tree/js/notebooklist.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ define([
102102
this.sessions = {};
103103
this.base_url = options.base_url || utils.get_body_data("baseUrl");
104104
this.notebook_path = options.notebook_path || utils.get_body_data("notebookPath");
105+
this.initial_notebook_path = this.notebook_path;
105106
this.contents = options.contents;
106107
if (this.session_list && this.session_list.events) {
107108
this.session_list.events.on('sessions_loaded.Dashboard',
@@ -358,7 +359,8 @@ define([
358359
var that = this;
359360
// Add an event handler browser back and forward events
360361
window.onpopstate = function(e) {
361-
var path = window.history.state ? window.history.state.path : '';
362+
var path = (window.history.state && window.history.state.path) ?
363+
window.history.state.path : that.initial_notebook_path;
362364
that.update_location(path);
363365
};
364366
var breadcrumb = $('.breadcrumb');

0 commit comments

Comments
 (0)