Page MenuHomePhabricator

D6476.diff
No OneTemporary

D6476.diff

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(

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 21, 5:34 AM (20 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2553868
Default Alt Text
D6476.diff (1 KB)

Event Timeline