diff --git a/src/screen.js b/src/screen.js index 93c9b017e5..33e2be0313 100644 --- a/src/screen.js +++ b/src/screen.js @@ -205,11 +205,14 @@ if ((!view_type) || (!this.current_view) || (this.current_view.view_type != view_type)) { var switch_current_view = (function() { - this.current_view = this.views.slice(-1); + this.current_view = this.views[this.views.length - 1]; return this.switch_view(view_type); }.bind(this)); for (var i = 0; i < this.number_of_views(); i++) { if (this.view_to_load.length) { + if (!view_type) { + view_type = this.view_to_load[0]; + } return this.load_next_view().pipe(switch_current_view); } this.current_view = this.views[ diff --git a/src/tab.js b/src/tab.js index 1ddb3b327c..a056e94a5a 100644 --- a/src/tab.js +++ b/src/tab.js @@ -87,11 +87,9 @@ var toolbar = this.create_toolbar(); el.append(toolbar); this.el = el; - this.view_prm = this.screen.load_next_view().then(function() { - screen.switch_view().done(function() { - el.append(screen.screen_container.el); - screen.search_filter(); - }); + this.view_prm = this.screen.switch_view().done(function() { + el.append(screen.screen_container.el); + screen.search_filter(); }); }, // TODO translate labels