Closed steveluscher closed 2 years ago
OK, I figured out why this is.
On desktop web, we never ‘leave’ the webpage; all interaction with the wallet happens between the browser's JS context and the browser extension.
On mobile web, every time we trigger the solana-wallet://
Universal Link, the browser's beforeunload
event fires. Our code currently kneecaps disconnect
events if they are received during the period where we believe that the browser is unloading.
cc/ @jordansexton.
Ah, makes sense + good find. We could find a way to special case that code when the selected adapter is MWA?
Repro
Observe that the disconnect happens and the user's balance gets zeroed out, but the React tree does not rerender (so the pubkey does not become
null
) and now your UI is in an inconsistent state.There's just a race condition somewhere. Probably the event that listens to
disconnect
is getting unhooked before thedisconnect
event is fired. Something like that.https://user-images.githubusercontent.com/13243/183160402-ced3c2a2-3664-4af3-ac1b-018b4dfab8f2.mov