web-examples
web-examples copied to clipboard
In React Wallet v2 the modal closes if another request is made right after connecting
Note this can be reproduced only after this other PR is merged: https://github.com/WalletConnect/web-examples/pull/301
There's a "strange" behavior when making another request like near_signIn right after the connect has been approved as shown in the video below:
What I suspect is that this line ModalStore.close() in SessionProposalModal is executed a bit later then the new session_request for near_signIn has been made. As shown in the video right after clicking "Approve" the request for near_signIn shows for a split second and the modal gets closed without giving a chance to either approve or reject.
If we add some waiting time between the connect and another request in a dApp then the modals open and close correctly, but this is not an ideal solution
// this is some dummy pseudo code
await signClient.connect(params)
await wait(1000) // wait for 1 sec
// make a new request
await signClient.request(params)