Skip to content

Commit b58c34e

Browse files
committed
Cyclically go through domain objects
Fixes an issue where resetting the app data would cause the app to crash because of an increase in data-tab-id of the server tab element. Fix Travis errors Fix Travis errors Fix Travis errors
1 parent dfeb1b7 commit b58c34e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/renderer/js/main.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,25 @@ class ServerManagerView {
159159
const showSidebar = ConfigUtil.getConfigItem('showSidebar', true);
160160
this.toggleSidebar(showSidebar);
161161
// Allow dragging of server tabs and update the data-tab-id
162-
const onEnd = (function onDragEnd(event) {
162+
const onEnd = () => {
163163
const newTabs = [];
164164
const domains = [];
165165
const tabElements = document.querySelectorAll('#tabs-container .tab');
166166
tabElements.forEach((el, index) => {
167-
const oldIndex = +Number(el.getAttribute('data-tab-id'));
167+
const oldIndex = +Number(el.getAttribute('data-tab-id')) % tabElements.length;
168168
el.setAttribute('data-tab-id', index.toString());
169169
domains.push(DomainUtil.getDomain(oldIndex));
170170
newTabs.push(this.tabs[oldIndex]);
171171
});
172-
for (let index = 0; index < domains.length; ++index) {
172+
/*for (let index = 0; index < domains.length; ++index) {
173173
DomainUtil.updateDomain(index, domains[index]);
174174
}
175175
this.tabs = newTabs;
176176
ipcRenderer.send('update-menu', {
177177
tabs: this.tabs,
178178
activeTabIndex: this.activeTabIndex
179-
});
180-
}).bind(this);
179+
});*/
180+
};
181181
this.$sortable = Sortable.create(this.$drag, {
182182
dataIdAttr: 'data-sortable-id',
183183
onEnd

0 commit comments

Comments
 (0)