Skip to content

Commit 9300d6b

Browse files
committed
Preserve old order of server tabs
1 parent 3ec20ca commit 9300d6b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

app/renderer/js/main.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,18 @@ class ServerManagerView {
155155
initTabs() {
156156
const servers = DomainUtil.getDomains();
157157
if (servers.length > 0) {
158+
for (let i = 0; i < servers.length; i++) {
159+
this.initServer(servers[i], i);
160+
DomainUtil.updateSavedServer(servers[i].url, i);
161+
}
162+
// activate last active tab and load its webview first
158163
const lastActiveTab = ConfigUtil.getConfigItem('lastActiveTab');
159-
this.initServer(servers[lastActiveTab], 0);
160-
DomainUtil.updateSavedServer(servers[lastActiveTab].url, 0);
161-
this.activateTab(0);
164+
this.activateTab(lastActiveTab);
162165
for (let i = 0; i < servers.length; i++) {
163-
let index = i;
164-
if (i < lastActiveTab) {
165-
++index;
166-
} else if (i > lastActiveTab) {
167-
--index;
168-
} else {
166+
if (i === lastActiveTab) {
169167
continue;
170168
}
171-
this.initServer(servers[i], index);
172-
DomainUtil.updateSavedServer(servers[i].url, index);
173-
this.tabs[index].loadWebview();
169+
this.tabs[i].loadWebview();
174170
}
175171
// Remove focus from the settings icon at sidebar bottom
176172
this.$settingsButton.classList.remove('active');

0 commit comments

Comments
 (0)