Distinguishing MODAL_CLOSE triggered by the user? #4564
Unanswered
pepoospina
asked this question in
Developer Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to show a Loading component while the user connects to my app. The process includes connecting a wallet, signing a message and a few other things.
If the user cancels the connection by clicking on the close icon on the top right of the web3modal, I detect the MODAL_CLOSE event and I hide the Loading component and consider the process canceled.
I only consider the connecting process done when all the final state vars are ready to start using the app.
The configuration works fine in desktop. The MODAL_CLOSE is not called after the wallet connection and the signature request is done while the Loading component is shown.
However, on mobile, when the user selects Metamask app to connect, they are redirected to Metamask app, and when they approve my app connection and go back to my app, the MODAL_CLOSE event is called and my app thinks the connect process was cancelled by the user.
It seems dumb, but I cant get around this. Shouldn't there be a distinction between the case where the user closed the modal and when the modal was closed because a successful connection?
Maybe split the even in two (and maybe keep the three)
MODAL_CLOSE
MODAL_CLOSE_BY_USER and
MODAL_CLOSE_BY_SUCCESS
WDYT?
Beta Was this translation helpful? Give feedback.
All reactions