Skip to content

Commit

Permalink
fix: ens issue in dms (#3736)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Sep 7, 2023
2 parents 10af9e0 + 21f7f5e commit 1ec912c
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions apps/web/src/hooks/useMessagePreviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Map<string, Profile>>(
new Map()
);
Expand Down Expand Up @@ -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
Expand Down

2 comments on commit 1ec912c

@vercel
Copy link

@vercel vercel bot commented on 1ec912c Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

prerender – ./apps/prerender

prerender-lenster.vercel.app
prerender.lenster.xyz
prerender-git-main-lenster.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 1ec912c Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./apps/web

lenster.xyz
lenster.vercel.app
web-git-main-lenster.vercel.app
web-lenster.vercel.app

Please sign in to comment.