diff --git a/src/App.tsx b/src/App.tsx index 23c0f97..9751fd3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -328,7 +328,7 @@ function App() { useState(""); const {isUserBlocked, addToBlockList, - removeBlockFromList, getAllBlockedUsers} = useBlockedAddresses() + removeBlockFromList, getAllBlockedUsers} = useBlockedAddresses(extState === 'authenticated') const [isOpenDrawerLookup, setIsOpenDrawerLookup] = useState(false) const [isMain, setIsMain] = useState( window?.location?.href?.includes("?main=true") diff --git a/src/components/Chat/useBlockUsers.tsx b/src/components/Chat/useBlockUsers.tsx index b787735..146347a 100644 --- a/src/components/Chat/useBlockUsers.tsx +++ b/src/components/Chat/useBlockUsers.tsx @@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useRef } from "react"; -export const useBlockedAddresses = () => { +export const useBlockedAddresses = (isAuthenticated: boolean) => { const userBlockedRef = useRef({}) const userNamesBlockedRef = useRef({}) @@ -28,6 +28,9 @@ export const useBlockedAddresses = () => { }, []) useEffect(()=> { + if (!isAuthenticated) return; + userBlockedRef.current = {}; + userNamesBlockedRef.current = {}; const fetchBlockedList = async ()=> { try { const response = await new Promise((res, rej) => { @@ -86,7 +89,7 @@ export const useBlockedAddresses = () => { } } fetchBlockedList() - }, []) + }, [isAuthenticated]) const removeBlockFromList = useCallback(async (address, name)=> { if(name){ await new Promise((res, rej) => {