fix: switching the network in Settings tells open pages (closes #500)
Once Settings has saved the new network it asks the background to send chainChanged with the new chain id to every open tab, through the same function an approved site switch request uses. Only the extension's own pages can ask for that. Choosing the network already active changes nothing and sends nothing. Model: opus-5-5
This commit was merged in pull request #503.
This commit is contained in:
@@ -316,7 +316,11 @@ function init(ctx) {
|
||||
const networkSelect = $("settings-network");
|
||||
networkSelect.addEventListener("change", async () => {
|
||||
const newId = networkSelect.value;
|
||||
if (newId === state.networkId) return;
|
||||
const net = await onChainSwitch(newId);
|
||||
// Open pages are told by the background, as after a site's approved
|
||||
// switch request.
|
||||
notify({ type: "AUTISTMASK_NETWORK_CHANGED", chainId: net.chainId });
|
||||
$("settings-rpc").value = state.rpcUrl;
|
||||
$("settings-blockscout").value = state.blockscoutUrl;
|
||||
showFlash("Switched to " + net.name + ".");
|
||||
|
||||
Reference in New Issue
Block a user