From c1eb48dd9872db455c3e9993f2a7e6f9bf8d7382 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 77abc0c21f6d278a679b1dca8d52d4f213975c55 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 d9e6a8f663e5e12095127f4fc5701e354e8d594e 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 7f4bb04dbdfd57cc09fb2a4ea71c928b1705eeb4 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('/')