From 2dd704cea12c59dd0706b47c13713ea4e42073a5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Nov 2021 16:44:32 +0100 Subject: [PATCH 1/4] fix tabs appearing twice --- apps/remix-ide/src/app/panels/tab-proxy.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index 4f5a030e04..db83672020 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -227,22 +227,6 @@ export class TabProxy extends Plugin { tooltip: name, iconClass: helper.getPathIcon(name) }) - formatPath.shift() - if (formatPath.length > 0) { - const duplicateTabName = this.loadedTabs.find(({ title }) => title === formatPath.join('/')).name - const duplicateTabPath = duplicateTabName.split('/') - const duplicateTabFormatPath = [...duplicateTabPath].reverse() - const duplicateTabTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/') - - this.loadedTabs.push({ - id: duplicateTabName, - name: duplicateTabName, - title: duplicateTabTitle, - icon, - tooltip: duplicateTabName, - iconClass: helper.getPathIcon(duplicateTabName) - }) - } break } } From 73987bc5a06d445a5f4f05f242c0ef2af5a7cd9c Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Nov 2021 16:59:56 +0100 Subject: [PATCH 2/4] fix linting --- apps/remix-ide/src/app/panels/tab-proxy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index db83672020..a92f89f59a 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -218,7 +218,6 @@ export class TabProxy extends Plugin { if (index === -1) { title = formatPath.join('/') - const titleLength = formatPath.length this.loadedTabs.push({ id: name, name, From c0822ebaa62d308cf5e90030a81f7f65f31b5f49 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Nov 2021 17:25:57 +0100 Subject: [PATCH 3/4] readd handling duplicate path --- apps/remix-ide/src/app/panels/tab-proxy.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index a92f89f59a..5d053ec3f3 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -218,6 +218,7 @@ export class TabProxy extends Plugin { if (index === -1) { title = formatPath.join('/') + const titleLength = formatPath.length this.loadedTabs.push({ id: name, name, @@ -226,6 +227,25 @@ export class TabProxy extends Plugin { tooltip: name, iconClass: helper.getPathIcon(name) }) + formatPath.shift() + if (formatPath.length > 0) { + const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/')) + + if (index > -1) { + const duplicateTabName = this.loadedTabs[index].name + const duplicateTabPath = duplicateTabName.split('/') + const duplicateTabFormatPath = [...duplicateTabPath].reverse() + const duplicateTabTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/') + this.loadedTabs[index] = { + id: duplicateTabName, + name: duplicateTabName, + title: duplicateTabTitle, + icon, + tooltip: duplicateTabName, + iconClass: helper.getPathIcon(duplicateTabName) + } + } + } break } } From e3b3136063fe9898ebc1ae6acabb36fca3f57222 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Nov 2021 11:55:50 +0100 Subject: [PATCH 4/4] fix linting --- apps/remix-ide/src/app/panels/tab-proxy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index 5d053ec3f3..f4cc6408c0 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -230,7 +230,6 @@ export class TabProxy extends Plugin { formatPath.shift() if (formatPath.length > 0) { const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/')) - if (index > -1) { const duplicateTabName = this.loadedTabs[index].name const duplicateTabPath = duplicateTabName.split('/')