From 159df136c116b9943dfcbabff1da8b6efebf5954 Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 30 Jan 2024 10:27:18 -0800 Subject: [PATCH] move to correct file --- src/state/queries/post-feed.ts | 13 +++++++++++++ src/state/queries/profile.ts | 14 +------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts index 82acf397..b422fa8f 100644 --- a/src/state/queries/post-feed.ts +++ b/src/state/queries/post-feed.ts @@ -28,6 +28,7 @@ import {getModerationOpts} from '#/state/queries/preferences/moderation' import {KnownError} from '#/view/com/posts/FeedErrorMessage' import {embedViewRecordToPostView, getEmbeddedPost} from './util' import {useModerationOpts} from './preferences' +import {queryClient} from 'lib/react-query' type ActorDid = string type AuthorFilter = @@ -444,3 +445,15 @@ function assertSomePostsPassModeration(feed: AppBskyFeedDefs.FeedViewPost[]) { throw new Error(KnownError.FeedNSFPublic) } } + +export function resetProfilePostsQueries(did: string, timeout = 0) { + setTimeout(() => { + queryClient.resetQueries({ + predicate: query => + !!( + query.queryKey[0] === 'post-feed' && + (query.queryKey[1] as string)?.includes(did) + ), + }) + }, timeout) +} diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 3aa01f90..affb8295 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -17,12 +17,12 @@ import {updateProfileShadow} from '../cache/profile-shadow' import {uploadBlob} from '#/lib/api' import {until} from '#/lib/async/until' import {Shadow} from '#/state/cache/types' +import {resetProfilePostsQueries} from '#/state/queries/post-feed' import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue' import {RQKEY as RQKEY_MY_MUTED} from './my-muted-accounts' import {RQKEY as RQKEY_MY_BLOCKED} from './my-blocked-accounts' import {STALE} from '#/state/queries' import {track} from '#/lib/analytics/analytics' -import {queryClient} from '#/lib/react-query' export const RQKEY = (did: string) => ['profile', did] export const profilesQueryKey = (handles: string[]) => ['profiles', handles] @@ -434,15 +434,3 @@ export function* findAllProfilesInQueryData( } } } - -export function resetProfilePostsQueries(did: string, timeout = 0) { - setTimeout(() => { - queryClient.resetQueries({ - predicate: query => - !!( - query.queryKey[0] === 'post-feed' && - (query.queryKey[1] as string)?.includes(did) - ), - }) - }, timeout) -}