Problem
In use-xverse.ts, the async setupXverse function awaits getXverseProductInfo() and request('wallet_connect') before registering the accountChange listener. If the effect cleans up while those are pending (e.g. deps change quickly), the work continues unnecessarily.
Fix
Add a cancelled flag that the cleanup sets to true. Check it after each await to bail out early, avoiding unnecessary SDK calls and listener registration.
Note: addListener is synchronous, so there's no actual listener leak — this is purely an early-exit optimization.
Problem
In
use-xverse.ts, the asyncsetupXversefunction awaitsgetXverseProductInfo()andrequest('wallet_connect')before registering theaccountChangelistener. If the effect cleans up while those are pending (e.g. deps change quickly), the work continues unnecessarily.Fix
Add a
cancelledflag that the cleanup sets totrue. Check it after eachawaitto bail out early, avoiding unnecessary SDK calls and listener registration.Note:
addListeneris synchronous, so there's no actual listener leak — this is purely an early-exit optimization.