Skip to content

Commit 366d91f

Browse files
author
dschlabach
committed
test with ref
1 parent 6aa5c2f commit 366d91f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

playground/nextjs-app-router/components/AppProvider.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '@/types/onchainkit';
1313
import { OnchainKitProvider } from '@coinbase/onchainkit';
1414
import type React from 'react';
15-
import { createContext, useEffect, useState } from 'react';
15+
import { createContext, useEffect, useRef, useState } from 'react';
1616
import { useConnect, useConnectors } from 'wagmi';
1717
import { base } from 'wagmi/chains';
1818
import { WalletPreference } from './form/wallet-type';
@@ -140,8 +140,13 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
140140
}
141141
}, []);
142142

143+
const runningRef = useRef<number>(0);
144+
143145
// Connect to wallet if walletType changes
144146
useEffect(() => {
147+
runningRef.current += 1;
148+
console.log('RUNNING!', runningRef.current);
149+
145150
if (walletType === WalletPreference.SMART_WALLET) {
146151
connect({ connector: connectors[0] });
147152
} else if (walletType === WalletPreference.EOA) {

0 commit comments

Comments
 (0)