Skip to content

fix: guard wallet id storage access#2684

Open
daixihegu wants to merge 1 commit into
rainbow-me:mainfrom
daixihegu:main
Open

fix: guard wallet id storage access#2684
daixihegu wants to merge 1 commit into
rainbow-me:mainfrom
daixihegu:main

Conversation

@daixihegu

Copy link
Copy Markdown

Summary

Guard recent/latest wallet id storage access so RainbowKit does not throw when localStorage is unavailable.

Some browser environments can throw when reading window.localStorage or when calling storage methods. These helpers now treat unavailable storage as empty state and ignore failed writes/removals.

Testing

  • pnpm test:unit run packages/rainbowkit/src/wallets/latestWalletId.test.ts packages/rainbowkit/src/wallets/recentWalletIds.test.ts
  • pnpm test:unit run packages/rainbowkit/src/wallets/latestWalletId.test.ts packages/rainbowkit/src/wallets/recentWalletIds.test.ts packages/rainbowkit/src/wallets/getInjectedConnector.test.ts packages/rainbowkit/src/wallets/connectorsForWallets.test.ts
  • pnpm --filter @rainbow-me/rainbowkit typecheck
  • pnpm biome check .changeset/tidy-wallet-storage.md packages/rainbowkit/src/wallets/latestWalletId.ts packages/rainbowkit/src/wallets/latestWalletId.test.ts packages/rainbowkit/src/wallets/recentWalletIds.ts packages/rainbowkit/src/wallets/recentWalletIds.test.ts packages/rainbowkit/src/wallets/safeLocalStorage.ts
  • git diff --check

Signed-off-by: daixihegu <daixihegu@163.com>
@daixihegu daixihegu requested a review from a team as a code owner June 25, 2026 02:40
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

@daixihegu 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 Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 81cbbe6

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 81cbbe6. Configure here.

Comment thread packages/rainbowkit/src/wallets/recentWalletIds.ts
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