move to correct file

zio/stable
Hailey 2024-01-30 10:27:18 -08:00
parent 0ff6ee2fc8
commit 159df136c1
2 changed files with 14 additions and 13 deletions

View File

@ -28,6 +28,7 @@ import {getModerationOpts} from '#/state/queries/preferences/moderation'
import {KnownError} from '#/view/com/posts/FeedErrorMessage' import {KnownError} from '#/view/com/posts/FeedErrorMessage'
import {embedViewRecordToPostView, getEmbeddedPost} from './util' import {embedViewRecordToPostView, getEmbeddedPost} from './util'
import {useModerationOpts} from './preferences' import {useModerationOpts} from './preferences'
import {queryClient} from 'lib/react-query'
type ActorDid = string type ActorDid = string
type AuthorFilter = type AuthorFilter =
@ -444,3 +445,15 @@ function assertSomePostsPassModeration(feed: AppBskyFeedDefs.FeedViewPost[]) {
throw new Error(KnownError.FeedNSFPublic) 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)
}

View File

@ -17,12 +17,12 @@ import {updateProfileShadow} from '../cache/profile-shadow'
import {uploadBlob} from '#/lib/api' import {uploadBlob} from '#/lib/api'
import {until} from '#/lib/async/until' import {until} from '#/lib/async/until'
import {Shadow} from '#/state/cache/types' import {Shadow} from '#/state/cache/types'
import {resetProfilePostsQueries} from '#/state/queries/post-feed'
import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue' import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue'
import {RQKEY as RQKEY_MY_MUTED} from './my-muted-accounts' import {RQKEY as RQKEY_MY_MUTED} from './my-muted-accounts'
import {RQKEY as RQKEY_MY_BLOCKED} from './my-blocked-accounts' import {RQKEY as RQKEY_MY_BLOCKED} from './my-blocked-accounts'
import {STALE} from '#/state/queries' import {STALE} from '#/state/queries'
import {track} from '#/lib/analytics/analytics' import {track} from '#/lib/analytics/analytics'
import {queryClient} from '#/lib/react-query'
export const RQKEY = (did: string) => ['profile', did] export const RQKEY = (did: string) => ['profile', did]
export const profilesQueryKey = (handles: string[]) => ['profiles', handles] 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)
}