diff --git a/app/renderer/js/main.js b/app/renderer/js/main.js index 9251745c3..4eed92e63 100644 --- a/app/renderer/js/main.js +++ b/app/renderer/js/main.js @@ -162,19 +162,21 @@ class ServerManagerView { const onEnd = event => { const newTabs = []; const domains = []; + const indexMap = {}; const tabElements = document.querySelectorAll('#tabs-container .tab'); tabElements.forEach((el, index) => { 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]); + indexMap[String(oldIndex)] = index; this.replaceServer(domains[index], index, oldIndex); }); for (let index = 0; index < domains.length; ++index) { DomainUtil.updateSavedServer(domains[index].url, index); } + this.activeTabIndex = indexMap[String(this.activeTabIndex)]; this.tabs = newTabs; - this.activeTabIndex = event.newIndex; ipcRenderer.send('update-menu', { tabs: this.tabs, activeTabIndex: this.activeTabIndex @@ -237,7 +239,11 @@ class ServerManagerView { const onHover = this.onHover.bind(this, oldIndex); const onHoverOut = this.onHoverOut.bind(this, oldIndex); this.tabs[index].updateListeners(onClick, onHover, onHoverOut); - this.tabs[index].updateShortcutText(index); + this.tabs[index].updateShortcutText(index);`` + this.tabs[index].webview.props.index = index; + this.tabs[index].webview.props.isActive = () => { + return oldIndex === this.activeTabIndex; + }; } initActions() {