Skip to content

Commit 276474a

Browse files
authored
Merge pull request #3411 from takluyver/notebooklist-back-to-start
Fix going back to root directory with history in notebook list
2 parents 7fb0510 + 0c28482 commit 276474a

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
@@ -96,6 +96,7 @@ define([
9696
this.sessions = {};
9797
this.base_url = options.base_url || utils.get_body_data("baseUrl");
9898
this.notebook_path = options.notebook_path || utils.get_body_data("notebookPath");
99+
this.initial_notebook_path = this.notebook_path;
99100
this.contents = options.contents;
100101
if (this.session_list && this.session_list.events) {
101102
this.session_list.events.on('sessions_loaded.Dashboard',
@@ -351,7 +352,8 @@ define([
351352
var that = this;
352353
// Add an event handler browser back and forward events
353354
window.onpopstate = function(e) {
354-
var path = window.history.state ? window.history.state.path : '';
355+
var path = (window.history.state && window.history.state.path) ?
356+
window.history.state.path : that.initial_notebook_path;
355357
that.update_location(path);
356358
};
357359
var breadcrumb = $('.breadcrumb');

0 commit comments

Comments
 (0)