From 21f7f5eea433cc1d001cc55d603d391d6298c321 Mon Sep 17 00:00:00 2001 From: bhavya2611 Date: Thu, 7 Sep 2023 11:27:48 +0530 Subject: [PATCH] fix: ens issue in dms --- apps/web/src/hooks/useMessagePreviews.tsx | 31 ++++++++++------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/apps/web/src/hooks/useMessagePreviews.tsx b/apps/web/src/hooks/useMessagePreviews.tsx index 84ed5ae8b92..682ce48052b 100644 --- a/apps/web/src/hooks/useMessagePreviews.tsx +++ b/apps/web/src/hooks/useMessagePreviews.tsx @@ -50,7 +50,6 @@ const useMessagePreviews = () => { const [loadProfiles] = useProfilesLazyQuery(); const selectedTab = useMessageStore((state) => state.selectedTab); const setEnsNames = useMessageStore((state) => state.setEnsNames); - const ensNames = useMessageStore((state) => state.ensNames); const [profilesToShow, setProfilesToShow] = useState>( new Map() ); @@ -104,25 +103,23 @@ const useMessagePreviews = () => { useEffect(() => { const getEns = async () => { - if (selectedTab === MessageTabs.Inbox) { - const chunks = chunkArray( - Array.from(nonLensProfiles), - MAX_PROFILES_PER_REQUEST - ); - let newEnsNames = new Map(); - for (const chunk of chunks) { - const ensResponse = await resolveEns(chunk); - const ensNamesData = ensResponse.data; - let i = 0; - for (const ensName of ensNamesData) { - if (ensName !== '') { - newEnsNames.set(chunk[i], ensName); - } - i++; + const chunks = chunkArray( + Array.from(nonLensProfiles), + MAX_PROFILES_PER_REQUEST + ); + let newEnsNames = new Map(); + for (const chunk of chunks) { + const ensResponse = await resolveEns(chunk); + const ensNamesData = ensResponse.data; + let i = 0; + for (const ensName of ensNamesData) { + if (ensName !== '') { + newEnsNames.set(chunk[i], ensName); } + i++; } - setEnsNames(new Map(newEnsNames)); } + setEnsNames(new Map(newEnsNames)); }; getEns(); // eslint-disable-next-line react-hooks/exhaustive-deps