diff --git a/apps/remix-ide/src/app/components/pinned-panel.tsx b/apps/remix-ide/src/app/components/pinned-panel.tsx index b9d9d5b416..9bb87fabff 100644 --- a/apps/remix-ide/src/app/components/pinned-panel.tsx +++ b/apps/remix-ide/src/app/components/pinned-panel.tsx @@ -25,12 +25,18 @@ export class PinnedPanel extends AbstractPanel { onActivation() { this.renderComponent() + this.on('sidePanel', 'pluginDisabled', (name) => { + if (this.plugins[name] && this.plugins[name].active) { + this.emit('unPinnedPlugin', name) + this.events.emit('unPinnedPlugin', name) + } + }) } async pinView (profile, view) { const activePlugin = this.currentFocus() - if (activePlugin === profile.name) throw new Error(`Plugin ${profile.name} already pinned`) + if (activePlugin === profile.name) throw new Error(`Plugin ${profile.name} already pinned`) if (activePlugin) { await this.call('sidePanel', 'unPinView', this.plugins[activePlugin].profile, this.plugins[activePlugin].view) this.remove(activePlugin) diff --git a/apps/remix-ide/src/app/components/side-panel.tsx b/apps/remix-ide/src/app/components/side-panel.tsx index 5a3f79851e..3e62f8bea1 100644 --- a/apps/remix-ide/src/app/components/side-panel.tsx +++ b/apps/remix-ide/src/app/components/side-panel.tsx @@ -58,10 +58,8 @@ export class SidePanel extends AbstractPanel { } removeView(profile) { - if (this.plugins[profile.name].active) this.call('menuicons', 'select', 'filePanel') + if (this.plugins[profile.name] && this.plugins[profile.name].active) this.call('menuicons', 'select', 'filePanel') super.removeView(profile) - this.emit('pluginDisabled', profile.name) - this.call('menuicons', 'unlinkContent', profile) this.renderComponent() } @@ -73,7 +71,10 @@ export class SidePanel extends AbstractPanel { async pinView (profile) { await this.call('pinnedPanel', 'pinView', profile, this.plugins[profile.name].view) - this.removeView(profile) + if (this.plugins[profile.name].active) this.call('menuicons', 'select', 'filePanel') + super.remove(profile.name) + this.call('menuicons', 'unlinkContent', profile) + this.renderComponent() } async unPinView (profile, view) {