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

Uncomment menu updation on drag
  • Loading branch information
kanishk98 committed Jan 8, 2019
1 parent dfeb1b7 commit b9e600b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/renderer/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ 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]);
Expand All @@ -177,7 +177,7 @@ class ServerManagerView {
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 b9e600b

Please sign in to comment.