diff --git a/apps/remix-ide/src/app/providers/grid-providers.tsx b/apps/remix-ide/src/app/providers/grid-providers.tsx
index 568ce325067..a2d57c7be83 100644
--- a/apps/remix-ide/src/app/providers/grid-providers.tsx
+++ b/apps/remix-ide/src/app/providers/grid-providers.tsx
@@ -107,9 +107,16 @@ export class GridProviders extends ViewPlugin {
plugin={this}
title={provider.name}
pinned={this.pinnedProviders.includes(provider.name)}
- pinStateCallback={(pinned: boolean) => {
- this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)}
- }
+ pinStateCallback={async (pinned: boolean) => {
+ const providerName = await this.call('blockchain', 'getProvider')
+ if (providerName !== provider.name) {
+ this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)
+ return true
+ } else {
+ this.call('notification', 'toast', 'Cannot unpin the current selected provider')
+ return false
+ }
+ }}
>
{provider.name}
@@ -122,11 +129,18 @@ export class GridProviders extends ViewPlugin {
>{this.providers['Remix VMs'].map(provider => {
return {
- this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)}
- }
title={provider.name}
+ pinned={this.pinnedProviders.includes(provider.name)}
+ pinStateCallback={async (pinned: boolean) => {
+ const providerName = await this.call('blockchain', 'getProvider')
+ if (providerName !== provider.name) {
+ this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)
+ return true
+ } else {
+ this.call('notification', 'toast', 'Cannot unpin the current selected provider')
+ return false
+ }
+ }}
>
{provider.name}
@@ -138,11 +152,18 @@ export class GridProviders extends ViewPlugin {
>{this.providers['Externals'].map(provider => {
return {
- this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)}
- }
title={provider.name}
+ pinned={this.pinnedProviders.includes(provider.name)}
+ pinStateCallback={async (pinned: boolean) => {
+ const providerName = await this.call('blockchain', 'getProvider')
+ if (providerName !== provider.name) {
+ this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)
+ return true
+ } else {
+ this.call('notification', 'toast', 'Cannot unpin the current selected provider')
+ return false
+ }
+ }}
>
{provider.name}
diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx
index 73c4c2ef7cd..4ac4cae5348 100644
--- a/apps/remix-ide/src/blockchain/blockchain.tsx
+++ b/apps/remix-ide/src/blockchain/blockchain.tsx
@@ -531,7 +531,7 @@ export class Blockchain extends Plugin {
changeExecutionContext(context, confirmCb, infoCb, cb) {
if (context.context === 'item-another-chain') {
- this.call('manager', 'activatePlugin', 'gridProviders')
+ this.call('manager', 'activatePlugin', 'gridProviders').then(() => this.call('tabs', 'focus', 'gridProviders'))
} else {
return this.executionContext.executionContextChange(context, null, confirmCb, infoCb, cb)
}
diff --git a/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx b/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx
index 03c8d83ce22..a1c1642727a 100644
--- a/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx
+++ b/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx
@@ -52,9 +52,8 @@ export const RemixUIGridCell = (props: RemixUIGridCellProps) => {
{ filterCon.showPin && }
{ props.tagList &&
diff --git a/libs/remix-ui/run-tab/src/lib/components/environment.tsx b/libs/remix-ui/run-tab/src/lib/components/environment.tsx
index 07df28e3827..d1ec5f942bd 100644
--- a/libs/remix-ui/run-tab/src/lib/components/environment.tsx
+++ b/libs/remix-ui/run-tab/src/lib/components/environment.tsx
@@ -49,6 +49,11 @@ export function EnvironmentUI(props: EnvironmentProps) {
)}
+ {props.providers.providerList.length === 0 ?
+
+ No provider pinned
+
+ : ''}
{props.providers.providerList.map(({ displayName, name }, index) => (