Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,13 @@ export const NetworkListMenu = ({ onClose }: NetworkListMenuProps) => {
dispatch(showPermittedNetworkToast());
}

dispatch(
setNetworkClientIdForDomain(selectedTabOrigin, finalNetworkClientId),
await setNetworkClientIdForDomain(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

setNetworkClientIdForDomain returns a Promise, not a Redux thunk. The code was incorrectly wrapping this function call with dispatch():
This caused the execution to fail silently, preventing setActiveNetwork from being reached.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great find! That does look like it's fixed it. Though I think the part that filters the global network menu is setEnabledNetworks not setActiveNetwork, right? Not totally sure what setActiveNetwork is supposed to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that the setActiveNetwork is what switches the network; it calls the networkController.
The setEnabledNetworks; controls which networks appear in the network list UI
Just updates enabledNetworkMap state and it calls the networkEnablementController

selectedTabOrigin,
finalNetworkClientId,
);
}

dispatch(setActiveNetwork(finalNetworkClientId));
await dispatch(setActiveNetwork(finalNetworkClientId));
dispatch(updateCustomNonce(''));
dispatch(setNextNonce(''));
dispatch(detectNfts(allChainIds));
Expand Down
Loading