From 5ad09aeff1824adf211a64ce573ae1792be25dec Mon Sep 17 00:00:00 2001 From: LouisWT <18911761491@163.com> Date: Fri, 31 Mar 2023 23:52:20 +0800 Subject: [PATCH] fix(start-app): check network.chain non null --- packages/starter-dapp/src/components/buttons/Connect.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/starter-dapp/src/components/buttons/Connect.svelte b/packages/starter-dapp/src/components/buttons/Connect.svelte index 9c9cc8e819e..0e4cf274761 100644 --- a/packages/starter-dapp/src/components/buttons/Connect.svelte +++ b/packages/starter-dapp/src/components/buttons/Connect.svelte @@ -48,7 +48,11 @@ const { chain } = getNetwork(); await setSigner(); await changeChain(chain.id); - watchNetwork(async (network) => await changeChain(network.chain.id)); + watchNetwork(async (network) => { + if (network.chain?.id) { + changeChain(network.chain.id); + } + }); } async function connectWithConnector(connector: Connector) {