« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ui.js b/ui.js
index 1ed8c42..7bbfd84 100644
--- a/ui.js
+++ b/ui.js
@@ -1911,17 +1911,18 @@ class GrouplikeListingElement extends Form {
 
     const parent = this.grouplike[parentSymbol]
     if (parent) {
+      const form = this.form
       const oldGrouplike = this.grouplike
+
       this.loadGrouplike(parent)
+      form.curIndex = form.firstItemIndex
+      this.restoreGrouplikeData()
 
-      const form = this.form
       const index = form.inputs.findIndex(inp => inp.item === oldGrouplike)
       if (typeof index === 'number') {
         form.curIndex = index
-      } else {
-        form.curIndex = form.firstItemIndex
       }
-      this.restoreGrouplikeData()
+
       form.updateSelectedElement()
       form.scrollSelectedElementIntoView()
     }