Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3325249
D6476.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6476.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6476: [lib] Add React.useMemo around useENSNames result
Attached
Detach File
Event Timeline
Log In to Comment