File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ export function App() {
4848 const [ lastTxHash , setLastTxHash ] = useState < string | null > ( null ) ;
4949
5050 const lastPendingIdRef = useRef < string | null > ( null ) ;
51+ const prevSelectedUuidRef = useRef < string | null > ( null ) ;
52+ const pollFnRef = useRef < ( ) => void > ( ( ) => { } ) ;
5153
5254 const walletClient = useMemo ( ( ) => {
5355 if ( ! selected ) return undefined ;
@@ -111,8 +113,6 @@ export function App() {
111113 } catch { }
112114 } , [ ensureServerConnected , pending ] ) ;
113115
114- const pollFnRef = useRef < ( ) => void > ( ( ) => { } ) ;
115-
116116 const connect = async ( ) => {
117117 if ( ! walletClient || ! selected ) return ;
118118
@@ -187,9 +187,15 @@ export function App() {
187187
188188 // Upon switching wallets, reset state.
189189 useEffect ( ( ) => {
190- if ( selectedUuid ) {
191- resetClientState ( ) ;
190+ if (
191+ prevSelectedUuidRef . current &&
192+ selectedUuid &&
193+ prevSelectedUuidRef . current !== selectedUuid
194+ ) {
195+ void resetClientState ( ) ;
192196 }
197+
198+ prevSelectedUuidRef . current = selectedUuid ;
193199 } , [ selectedUuid , resetClientState ] ) ;
194200
195201 // Auto-select if only one wallet is available.
You can’t perform that action at this time.
0 commit comments