fix: surface error when wallet is on an unsupported chain in SignIn#2679
Open
sulhadin wants to merge 1 commit into
Open
fix: surface error when wallet is on an unsupported chain in SignIn#2679sulhadin wants to merge 1 commit into
sulhadin wants to merge 1 commit into
Conversation
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.
🦋 Changeset detectedLatest commit: d0b3296 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
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 |
|
@sulhadin is attempting to deploy a commit to the rainbowdotme Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:When
useAccount().chain?.idisundefined(the wallet is connected on a chain that is not in the configuredchainslist), this branch silently returns. The user has no idea why the button doesn't work.This PR keeps the
!addressand!noncebranches as silent returns (those are transient or wagmi-level concerns and the button is already disabled while the nonce is loading), but splits out!chainIdinto its own branch that surfaces an actionable error:Changes
packages/rainbowkit/src/components/SignIn/SignIn.tsx— split the silent bail; surfacesign_in.signature.unsupported_chain_errorwhenchainIdis 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 mocksuseAccountto returnchain: undefinedand asserts the error message is rendered and that neithercreateMessagenorsignMessageAsyncis called..changeset/— patch changeset describing the user-facing change.How to reproduce the original behavior
chains: [mainnet]).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.en_US.jsonlocale file is modified, in line with the contribution guidelines.Notes
!chainIdcase is split out; the other two (!address,!nonce) keep their original silent-return behavior since the button is already disabled in those cases.