feat(wallet): disconnect and swap Freighter profiles without page refresh#56
Merged
meshackyaro merged 5 commits intoJun 24, 2026
Conversation
|
@stephanieoghenemega-eng is attempting to deploy a commit to the Meshack Yaro 's projects Team on Vercel. A member of the Team first needs to authorize it. |
meshackyaro
approved these changes
Jun 24, 2026
10 tasks
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.
Closes #4
The problem
hooks/useAccount.tsstored the wallet address in a module-level variable and only fetched it once. The file even documented the bug: "This does not update the return value if the user changes their Freighter settings; they will need to refresh the page."Switching Freighter profiles left stale address state everywhere until a manual reload. There was also no disconnect UI — the navbar had no wallet indicator at all.
Changes
hooks/useAccount.tsRewrote to use
useStateand subscribe to Freighter'swatchWalletevent, which fires whenever the active profile changes in the extension:Account switches now update the UI in real time across every component that calls
useAccount().components/atoms/wallet-button/index.tsx(new)A
WalletButtoncomponent that shows the connected address and a dropdown with two actions:setAllowed()to open the Freighter permission popup so the user can approve a different profileonDisconnectcallback which clears local state (Freighter has no server-side session to invalidate)Closes on outside click via a
mousedownlistener attached todocument.components/organisms/navbar/index.tsxThe navbar now shows the wallet state:
<ConnectButton label="Connect wallet" /><WalletButton address={...} onDisconnect={...} />Both desktop and mobile drawer updated. The green dot on
WalletButtonmakes the connected state immediately visible.Before / After
Before: No wallet UI in the navbar.
useAccountreturned stale data after profile switch.After: Connected address shown as
GABC...WXYZwith a green indicator. Switching profiles in Freighter updates the displayed address immediately. Clicking "Disconnect" clears the session.Test plan