From 3e53d08874891ca62f6b1f17c579f7515863fcef Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Tue, 15 Feb 2022 11:27:06 +0100 Subject: [PATCH] fix: simplifies session deleted handling --- .../src/contexts/ClientContext.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx b/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx index fd94840..20ec0eb 100644 --- a/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx +++ b/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx @@ -82,12 +82,6 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac throw new Error("WalletConnect is not initialized"); } - let _session = {} as SessionTypes.Settled; - - if (_client.session.topics.length) { - _session = await _client.session.get(_client.session.topics[0]); - } - _client.on(CLIENT_EVENTS.pairing.proposal, async (proposal: PairingTypes.Proposal) => { const { uri } = proposal.signal.params; console.log("EVENT", "QR Code Modal open"); @@ -100,8 +94,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac setPairings(_client.pairing.topics); }); - _client.on(CLIENT_EVENTS.session.deleted, (deletedSession: SessionTypes.Settled) => { - if (deletedSession.topic !== _session?.topic) return; + _client.on(CLIENT_EVENTS.session.deleted, () => { console.log("EVENT", "session_deleted"); resetApp(); });