feat(wallet): ensure proper session cleanup on disconnect - #52
Merged
Conversation
|
@Wisdom2788 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This was referenced Apr 25, 2026
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
Implements secure wallet disconnection with full session cleanup per issue #38.
What was built
store/walletStore.ts— Zustand store holding wallet state (address,isConnected,chainId) with aclearWalletStateaction and sharedWALLET_STORAGE_KEYconstantservices/walletService.ts— API service layer that notifies the backend to invalidate the wallet session viaPOST /api/wallet/disconnecthooks/useWallet.ts— orchestration hook: calls service → clears Zustand state → removes localStorage cache → redirects to/login. Cleanup runs unconditionally viafinallyso a network failure can never leave stale wallet data on the clientcomponents/wallet/DisconnectButton.tsx— UI component consuminguseWallet, renders wallet address + active disconnect button when connected, disabled state when not connectedapp/(dashboard)/admin/page.tsx— wiredDisconnectButtoninto admin dashboardstore/__tests__/walletStore.test.ts+hooks/__tests__/useWallet.test.ts— 10 unit tests covering all disconnect scenarios including API failure resilienceAcceptance Criteria
clearWalletStateresetsaddresstonull/login(safe page) after disconnectwalletService.disconnect()— no inline mock objectsScreenshots
Closes #38