From 195d88f4526d5461e1b8388394260ae22a932e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C5=BD=C3=A1ra?= Date: Mon, 4 May 2020 20:39:06 +0200 Subject: [PATCH] clear selection on pushState, fixes #12 --- app/cyp.js | 4 +++- app/js/elements/library.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/cyp.js b/app/cyp.js index 1570fcc..b5f3ed1 100644 --- a/app/cyp.js +++ b/app/cyp.js @@ -1644,8 +1644,8 @@ class Library extends Component { _popState() { this.selection.clear(); - this._stateStack.pop(); + if (this._stateStack.length > 0) { let state = this._stateStack[this._stateStack.length-1]; this._showState(state); @@ -1682,7 +1682,9 @@ class Library extends Component { } _pushState(state) { + this.selection.clear(); this._stateStack.push(state); + this._showState(state); } diff --git a/app/js/elements/library.js b/app/js/elements/library.js index 9801c8b..ed80443 100644 --- a/app/js/elements/library.js +++ b/app/js/elements/library.js @@ -48,8 +48,8 @@ class Library extends Component { _popState() { this.selection.clear(); - this._stateStack.pop(); + if (this._stateStack.length > 0) { let state = this._stateStack[this._stateStack.length-1]; this._showState(state); @@ -86,7 +86,9 @@ class Library extends Component { } _pushState(state) { + this.selection.clear(); this._stateStack.push(state); + this._showState(state); }