Skip to content

fix: surface error when wallet is on an unsupported chain in SignIn#2679

Open
sulhadin wants to merge 1 commit into
rainbow-me:mainfrom
sulhadin:fix/sign-in-silent-bail-unsupported-chain
Open

fix: surface error when wallet is on an unsupported chain in SignIn#2679
sulhadin wants to merge 1 commit into
rainbow-me:mainfrom
sulhadin:fix/sign-in-silent-bail-unsupported-chain

Conversation

@sulhadin

Copy link
Copy Markdown

Summary

Some users got stuck on the Sign In screen with no feedback: clicking "Sign message" did nothing, no error, no log, no state change.

The reason is the early return in SignIn.signIn:

const chainId = activeChain?.id;
const { nonce } = state;

if (!address || !chainId || !nonce) {
  return;
}

When useAccount().chain?.id is undefined (the wallet is connected on a chain that is not in the configured chains list), this branch silently returns. The user has no idea why the button doesn't work.

This PR keeps the !address and !nonce branches as silent returns (those are transient or wagmi-level concerns and the button is already disabled while the nonce is loading), but splits out !chainId into its own branch that surfaces an actionable error:

Your wallet is on an unsupported network. Switch to a supported network and try again.

Changes

  • packages/rainbowkit/src/components/SignIn/SignIn.tsx — split the silent bail; surface sign_in.signature.unsupported_chain_error when chainId is missing.
  • packages/rainbowkit/src/locales/en_US.json — add the new key.
  • packages/rainbowkit/src/components/SignIn/SignIn.test.tsx — add a unit test that mocks useAccount to return chain: undefined and asserts the error message is rendered and that neither createMessage nor signMessageAsync is called.
  • .changeset/ — patch changeset describing the user-facing change.

How to reproduce the original behavior

  1. Build a dApp that configures wagmi with a single chain (e.g. chains: [mainnet]).
  2. Connect via WalletConnect from a mobile wallet whose active network is anything other than that chain (e.g. Sepolia or Polygon).
  3. The Sign Message screen appears. Clicking the button does nothing — no error, no log, no UI change.

With this PR, the user sees the unsupported-network error message and can act on it.

Test plan

  • pnpm test:unit run -t SignIn — 4 tests pass (3 existing + 1 new).
  • pnpm lint — clean.
  • Only the en_US.json locale file is modified, in line with the contribution guidelines.

Notes

  • Only the !chainId case is split out; the other two (!address, !nonce) keep their original silent-return behavior since the button is already disabled in those cases.
  • Open to alternative wording for the error message if you prefer it shorter or differently phrased.

If useAccount returns chain as undefined (wallet connected on a chain
not in the configured chains list), the Sign Message button used to
silently return with no feedback. Now it shows a clear error.

Adds a unit test and the en_US locale key.
@sulhadin
sulhadin requested a review from a team as a code owner May 22, 2026 12:14
@changeset-bot

changeset-bot Bot commented May 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0b3296

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@rainbow-me/rainbowkit Patch
example Patch
@rainbow-me/rainbow-button Patch
rainbowkit-next-app Patch
site Patch
with-create-react-app Patch
with-next-app-i18n Patch
with-next-app Patch
with-next-custom-button Patch
with-next-mint-nft Patch
with-next-siwe-iron-session Patch
with-next-siwe-next-auth Patch
with-next-wallet-button Patch
with-next Patch
with-react-router Patch
with-remix Patch
with-vite Patch
with-next-rainbow-button Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown

@sulhadin is attempting to deploy a commit to the rainbowdotme Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant