Skip to content

fix(web): detect wallet account and network changes during session - #1326

Open
oluwaseyi1996-netizen wants to merge 3 commits into
drydocs:mainfrom
oluwaseyi1996-netizen:fix/detect-wallet-account-network-changes
Open

oluwaseyi1996-netizen wants to merge 3 commits into
drydocs:mainfrom
oluwaseyi1996-netizen:fix/detect-wallet-account-network-changes

Conversation

@oluwaseyi1996-netizen

@oluwaseyi1996-netizen oluwaseyi1996-netizen commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

  • Detect when the connected wallet switches account or network during an active session, update persisted session state, and invalidate stale positions and vault queries.
  • Block signing in useSignAndSubmit when a network mismatch is detected against APP_NETWORK.network.
  • Extend WalletAdapter with passive getAddress?() and getNetwork?() methods, implemented on FreighterWallet.
  • Guard against stale session writes and unwanted reconnects if the user disconnects or switches wallets while passive revalidation calls (getAddress/getNetwork) are in flight.
  • Add localized toast notifications for account and network switches in English and French catalogues.

Test plan

  • pnpm lint && pnpm typecheck && pnpm test pass locally
  • Verified passive Freighter address/network getters and fallbacks in apps/web/src/__tests__/lib/wallet.test.ts
  • Verified passive reconciliation and stale-session guards (disconnect / account switch during pending queries) in apps/web/src/__tests__/store/wallet.test.ts
  • Verified signing blocked on network mismatch in apps/web/src/__tests__/hooks/useSignAndSubmit.test.ts
  • Verified @meridian/web unit test suite passes (45 test files, 489 tests)

Closes #1300

@drips-wave

drips-wave Bot commented Nov 19, 2026

Copy link
Copy Markdown

@oluwaseyi1996-netizen 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! 🚀

Learn more about application limits

@collinsezedike collinsezedike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@oluwaseyi1996-netizen the description has no ## Test plan section, and the testing notes sit under Details. Restructure it to PULL_REQUEST_TEMPLATE.md.

Comment thread apps/web/src/store/wallet.ts Resolved
Comment thread apps/web/src/store/wallet.ts Resolved
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

@oluwaseyi1996-netizen is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

@oluwaseyi1996-netizen

Copy link
Copy Markdown
Author

@collinsezedike Updated! Restructured the PR description to ## Summary\ and ## Test plan\ per \PULL_REQUEST_TEMPLATE.md, and resolved the stale-session race condition when disconnecting while \getAddress\ or \getNetwork\ is pending (with new unit tests).

This branch has not been deployed

No deployments
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.

[Bug] Detect wallet account and network changes during a session

2 participants