Skip to content

fix: respect explicit chainStatus on ConnectButton for single-chain dApps#2676

Open
Kropiunig wants to merge 1 commit into
rainbow-me:mainfrom
Kropiunig:fix/1418-always-show-chain-status
Open

fix: respect explicit chainStatus on ConnectButton for single-chain dApps#2676
Kropiunig wants to merge 1 commit into
rainbow-me:mainfrom
Kropiunig:fix/1418-always-show-chain-status

Conversation

@Kropiunig

Copy link
Copy Markdown

Summary

Closes #1418.

The chain selector on ConnectButton is currently hidden whenever exactly one chain is configured, even when the consumer explicitly sets the chainStatus prop. The conditional at packages/rainbowkit/src/components/ConnectButton/ConnectButton.tsx:83 gates rendering on chains.length > 1 || unsupportedChain, so setting chainStatus="full"/"icon"/"name" has no effect for single-chain dApps. Authors who want to keep the active network visible have had to drop down to ConnectButton.Custom.

@DanielSinclair indicated in the issue thread that a prop-based way to always show the chain was the intended fix ("We'll work on a prop to always show the current chain"). Rather than introduce a new prop, this PR treats any explicit value for the existing chainStatus prop as an opt-in, while keeping the historical default-hide behavior for consumers that do not pass the prop.

Changes

  • packages/rainbowkit/src/components/ConnectButton/ConnectButton.tsx — Make the chain-selector visibility check honor an explicit chainStatus. The prop is read into a local chainStatusProp; chainStatusExplicit tracks whether the consumer passed any value, and a new || chainStatusExplicit branch is added to the existing chains.length > 1 || unsupportedChain guard. The internal chainStatus variable now falls back to the existing default when no value is supplied, so all downstream mapResponsiveValue(chainStatus, …) calls behave exactly as before. The chainStatus="none" escape hatch keeps working through the existing display sprinkle.
  • packages/rainbowkit/src/components/ConnectButton/ConnectButton.test.tsx — Adds a connected-state test suite covering: (1) default hide behavior for single-chain dApps, (2) explicit chainStatus="full" rendering the selector, (3) explicit chainStatus="none" keeping the selector suppressed via the display_none sprinkle.
  • site/data/en-US/docs/connect-button.mdx — Notes in the existing Chain status section that passing any explicit chainStatus value will force the selector to render on single-chain dApps.
  • .changeset/connect-button-explicit-chain-status.md — Patch-level changeset for @rainbow-me/rainbowkit.

Backwards compatibility

This is a non-breaking change. Consumers that do not pass chainStatus still see the existing default behavior (selector hidden on single-chain dApps). The behavior change only activates when chainStatus is passed explicitly — which today is a no-op for single-chain dApps anyway.

Test plan

pnpm test:unit run packages/rainbowkit/src/components/ConnectButton/
# Test Files  4 passed (4)
#      Tests  19 passed (19)

pnpm --filter @rainbow-me/rainbowkit typecheck
# clean

Per the locale-files note in AGENTS.md, only the en-US doc file was updated.

…Apps

Previously the chain selector on ConnectButton was hidden whenever
exactly one chain was configured, even when the consumer explicitly set
the chainStatus prop. This made it impossible to keep the active network
visible on the default ConnectButton without dropping down to
ConnectButton.Custom.

The default behavior is preserved (the selector is still hidden for
single-chain dApps that do not pass chainStatus). Passing any value for
chainStatus is now treated as an explicit opt-in: the selector renders
for 'full', 'icon', or 'name', and stays suppressed via the existing
display sprinkle for 'none'.

Closes rainbow-me#1418
@Kropiunig
Kropiunig requested a review from a team as a code owner May 16, 2026 15:07
@vercel

vercel Bot commented May 16, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented May 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: df63279

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

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.

[bug] Chains not shown for Connect Button if only one chain

1 participant