Skip to content

Commit

Permalink
Cyclically go through domain objects
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kanishk98 committed Jan 8, 2019
1 parent dfeb1b7 commit b58c34e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/renderer/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,25 @@ class ServerManagerView {
const showSidebar = ConfigUtil.getConfigItem('showSidebar', true);
this.toggleSidebar(showSidebar);
// Allow dragging of server tabs and update the data-tab-id
const onEnd = (function onDragEnd(event) {
const onEnd = () => {
const newTabs = [];
const domains = [];
const tabElements = document.querySelectorAll('#tabs-container .tab');
tabElements.forEach((el, index) => {
const oldIndex = +Number(el.getAttribute('data-tab-id'));
const oldIndex = +Number(el.getAttribute('data-tab-id')) % tabElements.length;
el.setAttribute('data-tab-id', index.toString());
domains.push(DomainUtil.getDomain(oldIndex));
newTabs.push(this.tabs[oldIndex]);
});
for (let index = 0; index < domains.length; ++index) {
/*for (let index = 0; index < domains.length; ++index) {
DomainUtil.updateDomain(index, domains[index]);
}
this.tabs = newTabs;
ipcRenderer.send('update-menu', {
tabs: this.tabs,
activeTabIndex: this.activeTabIndex
});
}).bind(this);
});*/
};
this.$sortable = Sortable.create(this.$drag, {
dataIdAttr: 'data-sortable-id',
onEnd
Expand Down

0 comments on commit b58c34e

Please sign in to comment.