Skip to content

Conversation

@petar-omni
Copy link
Collaborator

This pull request updates the @stakekit/rainbowkit package version and introduces a fix for wallet selection behavior in both desktop and mobile connection options. The main improvement ensures that the selectedChainGroupId is reset when navigating to the chain group selection step, preventing unintended state persistence.

Version update:

  • Bumped the package version from 2.2.7 to 2.2.8 in package.json to reflect the new changes.

State management fixes:

  • In DesktopOptions.tsx, added logic to reset selectedChainGroupId when the user navigates to the SelectChainGroup step, ensuring the correct selection state.
  • In MobileOptions.tsx, applied the same fix for mobile by resetting selectedChainGroupId when the user is at the SelectChainGroup step.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes a wallet selection state management issue in the RainbowKit library by resetting the selected chain group when navigating to the chain group selection step, preventing unintended state persistence across navigation.

  • Updated package version from 2.2.7 to 2.2.8
  • Added state reset logic for both desktop and mobile wallet connection flows
  • Ensures selectedChainGroupId is cleared when entering the SelectChainGroup step

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
MobileOptions.tsx Added conditional logic to reset selectedChainGroupId when entering chain group selection
DesktopOptions.tsx Added similar state reset logic for desktop wallet connection flow
package.json Bumped version to reflect the bug fix changes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +251 to +267
if (
walletStep === MobileWalletStep.SelectChainGroup &&
selectedChainGroupId
) {
setSelectedChainGroupId(undefined);
}
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This state update in the component body will cause an infinite re-render loop. The setSelectedChainGroupId(undefined) call will trigger a re-render, which will execute this condition again. Move this logic inside a useEffect hook with appropriate dependencies.

Suggested change
if (
walletStep === MobileWalletStep.SelectChainGroup &&
selectedChainGroupId
) {
setSelectedChainGroupId(undefined);
}
useEffect(() => {
if (
walletStep === MobileWalletStep.SelectChainGroup &&
selectedChainGroupId
) {
setSelectedChainGroupId(undefined);
}
}, [walletStep, selectedChainGroupId]);

Copilot uses AI. Check for mistakes.
Comment on lines 243 to 245
if (walletStep === WalletStep.SelectChainGroup && selectedChainGroupId) {
setSelectedChainGroupId(undefined);
}
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This state update in the component body will cause an infinite re-render loop. The setSelectedChainGroupId(undefined) call will trigger a re-render, which will execute this condition again. Move this logic inside a useEffect hook with appropriate dependencies.

Suggested change
if (walletStep === WalletStep.SelectChainGroup && selectedChainGroupId) {
setSelectedChainGroupId(undefined);
}
useEffect(() => {
if (walletStep === WalletStep.SelectChainGroup && selectedChainGroupId) {
setSelectedChainGroupId(undefined);
}
}, [walletStep, selectedChainGroupId]);

Copilot uses AI. Check for mistakes.
@petar-omni petar-omni force-pushed the fix/chain-group-picker branch from e48eb99 to eb5d5d8 Compare October 10, 2025 14:06
@petar-omni petar-omni force-pushed the fix/chain-group-picker branch from eb5d5d8 to 7742209 Compare October 13, 2025 21:25
@petar-omni petar-omni merged commit 5700a65 into main Oct 13, 2025
5 checks passed
@petar-omni petar-omni deleted the fix/chain-group-picker branch October 13, 2025 21:28
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.

3 participants