diff options
Diffstat (limited to 'src/state/queries/post-thread.ts')
-rw-r--r-- | src/state/queries/post-thread.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts index c616b05cc..4b586c862 100644 --- a/src/state/queries/post-thread.ts +++ b/src/state/queries/post-thread.ts @@ -8,10 +8,7 @@ import {useQuery, useQueryClient, QueryClient} from '@tanstack/react-query' import {getAgent} from '#/state/session' import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types' import {STALE} from '#/state/queries' -import { - findPostInQueryData as findPostInFeedQueryData, - FeedPostSliceItem, -} from './post-feed' +import {findPostInQueryData as findPostInFeedQueryData} from './post-feed' import {findPostInQueryData as findPostInNotifsQueryData} from './notifications/feed' import {precacheThreadPosts as precacheResolvedUris} from './resolve-uri' @@ -93,7 +90,7 @@ export function usePostThreadQuery(uri: string | undefined) { { const item = findPostInFeedQueryData(queryClient, uri) if (item) { - return feedItemToPlaceholderThread(item) + return feedViewPostToPlaceholderThread(item) } } { @@ -275,13 +272,15 @@ function threadNodeToPlaceholderThread( } } -function feedItemToPlaceholderThread(item: FeedPostSliceItem): ThreadNode { +function feedViewPostToPlaceholderThread( + item: AppBskyFeedDefs.FeedViewPost, +): ThreadNode { return { type: 'post', _reactKey: item.post.uri, uri: item.post.uri, post: item.post, - record: item.record, + record: item.post.record as AppBskyFeedPost.Record, // validated in post-feed parent: undefined, replies: undefined, viewer: item.post.viewer, @@ -291,7 +290,7 @@ function feedItemToPlaceholderThread(item: FeedPostSliceItem): ThreadNode { hasMore: false, showChildReplyLine: false, showParentReplyLine: false, - isParentLoading: !!item.record.reply, + isParentLoading: !!(item.post.record as AppBskyFeedPost.Record).reply, isChildLoading: !!item.post.replyCount, }, } @@ -305,7 +304,7 @@ function postViewToPlaceholderThread( _reactKey: post.uri, uri: post.uri, post: post, - record: post.record as AppBskyFeedPost.Record, // validate in notifs + record: post.record as AppBskyFeedPost.Record, // validated in notifs parent: undefined, replies: undefined, viewer: post.viewer, |