Using web3auth-wagmi-connector, opening the modal sets wagmi's state to connecting, closing the modal doesn't reset state

  • SDK Version: 6.1.7
  • Platform: Web

When using web3auth-wagmi-connector and opening the modal, the connector will trigger the state to “connecting” but closing the modal manually doesn’t reset the state, leaving it as “connecting”.

Is this expected behaviour?

Thank you!

Edit: Can confirm the same behaviour is present in the demo examples:

Edit: The issue has been raised in Github.

2 Likes

This issue will be fixed with the v7 release.

@maharshi
The behaviour remains the same in v7 in React with the following package versions:
@web3auth/base”: “^7.0.1”,
@web3auth/coinbase-adapter”: “^7.0.2”,
@web3auth/metamask-adapter”: “^7.0.1”,
@web3auth/modal”: “^7.0.3”,
@web3auth/web3auth-wagmi-connector”: “^5.0.1”

Could you confirm if the issue is supposed to be resolved? In which case maybe there is something wrong in our setup.

The temporary fix I found is:

  useEffect(() => {
    if (!web3Auth) return;

    const onModalVisibility = (isVisible: boolean) => {
      if (accountResult.isConnected || isVisible) {
        return;
      }

      disconnect();
    };

    web3Auth.on(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, onModalVisibility);

    return () => {
      web3Auth.off(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, onModalVisibility);
    };
  }, [accountResult.isConnected, disconnect, web3Auth]);

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.