about summary refs log tree commit diff
path: root/src/state/cache/profile-shadow.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/cache/profile-shadow.ts')
-rw-r--r--src/state/cache/profile-shadow.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/state/cache/profile-shadow.ts b/src/state/cache/profile-shadow.ts
index 59f79634d..5323effaf 100644
--- a/src/state/cache/profile-shadow.ts
+++ b/src/state/cache/profile-shadow.ts
@@ -1,4 +1,4 @@
-import {useEffect, useState, useCallback, useRef} from 'react'
+import {useEffect, useState, useMemo, useCallback, useRef} from 'react'
 import EventEmitter from 'eventemitter3'
 import {AppBskyActorDefs} from '@atproto/api'
 import {Shadow} from './types'
@@ -56,9 +56,11 @@ export function useProfileShadow(
     firstRun.current = false
   }, [profile])
 
-  return state.ts > ifAfterTS
-    ? mergeShadow(profile, state.value)
-    : {...profile, isShadowed: true}
+  return useMemo(() => {
+    return state.ts > ifAfterTS
+      ? mergeShadow(profile, state.value)
+      : {...profile, isShadowed: true}
+  }, [profile, state, ifAfterTS])
 }
 
 export function updateProfileShadow(