From 02eb83b0b1e0d275627c000b00c20931727e619f Mon Sep 17 00:00:00 2001 From: LouisWT <18911761491@163.com> Date: Sat, 1 Apr 2023 03:20:25 +0800 Subject: [PATCH] fix(starter-dapp): check network.chain non null (#13515) Co-authored-by: jeff <113397187+cyberhorsey@users.noreply.github.com> --- 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 cfa35b30cde..9a0c9cc0e7a 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) {