Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close wallet connection modal after connect with namespace #990

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

RyukTheCoder
Copy link
Collaborator

Summary

Wallet connection modal was not closing automatically after connecting a wallet which needs namespace selection or derivation path entering. It is fixed by calling afterConnect method after connecting wallet with namespace or derivation path.

Fixes # 2147

How did you test this change?

Tested by connecting a wallet which needs namespace or derivation path (such as phantom and ledger) and observing that wallet connection modal closes automatically after successful connect.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Implemented a user interface (UI) change, referencing our Figma design to ensure pixel-perfect precision.

handleClosingModal();
}

if (props.onConnect) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You spot the bug very well, afterConnected, there are one points on your approach:
props.onConnect will be called on each state/step, but it need only to be run on successful connection which means at the of the process, only once.

I suggest to see it as an effect. keep your afterConnected and instead of calling .then(afterConnected), do this:

useEffect(afterConnected, [getState().status])

Notes:

  • you can also define a ref using useRef to update and access to isConnected.
  • onConnect should be run once so in your afterConnected you need to have a condition like: !resultIsConnected || !resultIsDisconnected return; to stop proceeding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants