diff options
author | dan <dan.abramov@gmail.com> | 2023-11-17 17:31:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-17 09:31:26 -0800 |
commit | c858b583072d7858f50ee0d56bb76dbce5a9c13d (patch) | |
tree | 6fa7e969abc71b1b21c7586856bf013b8a3a96c8 /src/state/cache/profile-shadow.ts | |
parent | 9c8a1b8a3118f6a6994a3c6cf8e5b70ef10049ab (diff) | |
download | voidsky-c858b583072d7858f50ee0d56bb76dbce5a9c13d.tar.zst |
Do less work (#1953)
Diffstat (limited to 'src/state/cache/profile-shadow.ts')
-rw-r--r-- | src/state/cache/profile-shadow.ts | 10 |
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( |