diff --git a/lib/hooks/ens-cache.js b/lib/hooks/ens-cache.js --- a/lib/hooks/ens-cache.js +++ b/lib/hooks/ens-cache.js @@ -82,22 +82,26 @@ } }, [cachedInfo, fetchedAddresses, ensCache]); - return cachedInfo.map(user => { - if (!user) { - return user; - } - const { input, ethAddress, cachedResult } = user; - if (cachedResult) { - return { ...input, username: cachedResult }; - } else if (!ethAddress) { - return input; - } - const ensName = ensNames.get(ethAddress); - if (ensName) { - return { ...input, username: ensName }; - } - return input; - }); + return React.useMemo( + () => + cachedInfo.map(user => { + if (!user) { + return user; + } + const { input, ethAddress, cachedResult } = user; + if (cachedResult) { + return { ...input, username: cachedResult }; + } else if (!ethAddress) { + return input; + } + const ensName = ensNames.get(ethAddress); + if (ensName) { + return { ...input, username: ensName }; + } + return input; + }), + [cachedInfo, ensNames], + ); } function useStringForUser(