diff --git a/.changeset/healthy-coins-beg.md b/.changeset/healthy-coins-beg.md new file mode 100644 index 00000000..699b9d6a --- /dev/null +++ b/.changeset/healthy-coins-beg.md @@ -0,0 +1,5 @@ +--- +'@wagmi/connectors': patch +--- + +Fixed issue where `UNSTABLE_shimOnConnectSelectAccount` would not bubble up error for MetaMask if request to connect was already active. diff --git a/packages/connectors/src/metaMask.ts b/packages/connectors/src/metaMask.ts index 22049830..b52552c3 100644 --- a/packages/connectors/src/metaMask.ts +++ b/packages/connectors/src/metaMask.ts @@ -106,6 +106,12 @@ export class MetaMaskConnector extends InjectedConnector { // Only bubble up error if user rejects request if (this.isUserRejectedRequestError(error)) throw new UserRejectedRequestError(error) + // Or MetaMask is already open + if ( + (error as ResourceUnavailableError).code === + new ResourceUnavailableError(error).code + ) + throw error } }