fix: guard wallet id storage access#2684
Conversation
Signed-off-by: daixihegu <daixihegu@163.com>
|
@daixihegu is attempting to deploy a commit to the rainbowdotme Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 81cbbe6 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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.

Summary
Guard recent/latest wallet id storage access so RainbowKit does not throw when
localStorageis unavailable.Some browser environments can throw when reading
window.localStorageor 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.tspnpm 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.tspnpm --filter @rainbow-me/rainbowkit typecheckpnpm 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.tsgit diff --check