From 6a6c609817d3a0350984fcc68c25e6c19e4e6ffd Mon Sep 17 00:00:00 2001 From: apoorvlathey Date: Mon, 12 Jun 2023 01:45:02 +0530 Subject: [PATCH] persist last entered address if WC cache doesn't exist --- src/components/Body/index.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/Body/index.tsx b/src/components/Body/index.tsx index 48a6475..389ffff 100644 --- a/src/components/Body/index.tsx +++ b/src/components/Body/index.tsx @@ -147,9 +147,7 @@ function Body() { if (_legacySignClient.peerMeta) { try { setLegacySignClient(_legacySignClient); - setShowAddress( - _showAddress ? _showAddress : _legacySignClient.accounts[0] - ); + setShowAddress(_showAddress ?? _legacySignClient.accounts[0]); setAddress(_legacySignClient.accounts[0]); setUri(_legacySignClient.uri); setLegacyPeerMeta(_legacySignClient.peerMeta); @@ -164,6 +162,11 @@ function Body() { localStorage.removeItem("walletconnect"); } } + } else { + if (_showAddress) { + setShowAddress(_showAddress); + setAddress(_showAddress); + } } // WC V2 initWeb3Wallet(true, _showAddress); @@ -288,6 +291,10 @@ function Body() { } } else { setWeb3Wallet(_web3wallet); + if (_showAddress) { + setShowAddress(_showAddress); + setAddress(_showAddress); + } } // for debugging