Skip to content

Conversation

@RyukTheCoder
Copy link
Contributor

@RyukTheCoder RyukTheCoder commented Oct 27, 2025

Summary

Currently, initial and detached modals get displayed when user tries to connect a hub wallet. In this PR, a forcedNamespaces parameter is added to handleConnect method of useStatefulConnect hook to enable selecting some namespaces programmatically without displaying initial and detached modal. So when handleConnect gets called with some forcedNamespaces, those namespaces get connected and if one of them get an error, all of them get disconnected.

How did you test this change?

Tested by linking this PR to app and passed Solana and EVM namespaces as skipSelectNamespaces and observed the required behavior.

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.

path: string
path: string,
options?: {
forcedNamespaces?: Namespace[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's call the option: onlyConnectTo or forceConnectTo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to forceConnectToNamespaces. I think its better to keep namespaces in the naming.

: 'An unknown error happened during connecting wallet.';

if (options?.disconnectOnError) {
await handleDisconnect(wallet);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this may throw an error itself, you need to do something like L86 for .catch here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the only important error here is the error related to connecting the wallet, added a try/catch around the disconnect to warn the error related to disconnecting wallet in the console.

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.

3 participants