diff --git a/packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx b/packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx index 636b42fe6..3c5b30933 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx @@ -35,7 +35,7 @@ export const ChatSupportTest = () => { { (async () => { if(signer) { if (!account) { const address = await getAddressFromSigner(signer); setAccountadd(address); - const userAlice = await PushAPI.initialize(signer, {env: env , account:address}); - setUserAlice(userAlice) + } else{ setAccountadd(account); - const userAlice = await PushAPI.initialize(signer, {env: env , account:account}); - setUserAlice(userAlice) + } } })(); },[signer]) - + useEffect(() => { + ( + async() =>{ + if(Object.keys(signer || {}).length && accountadd){ + const userAlice = await PushAPI.initialize(signer!, {env: env , account:accountadd!}); + setUserAlice(userAlice) + } + } + )() + + },[signer, accountadd]) useEffect(() => { setChats([]);