diff --git a/src/components/posts/view-post/PostPage.tsx b/src/components/posts/view-post/PostPage.tsx index 696291398..6e5297a7f 100644 --- a/src/components/posts/view-post/PostPage.tsx +++ b/src/components/posts/view-post/PostPage.tsx @@ -32,7 +32,14 @@ import { useIsPostBlocked } from 'src/rtk/features/moderation/hooks' import { fetchPost, fetchPosts, selectPost } from 'src/rtk/features/posts/postsSlice' import { fetchPostsViewCount } from 'src/rtk/features/posts/postsViewCountSlice' import { useFetchMyReactionsByPostId } from 'src/rtk/features/reactions/myPostReactionsHooks' -import { asCommentStruct, DataSourceTypes, HasStatusCode, idToBn, PostData, PostWithSomeDetails } from 'src/types' +import { + asCommentStruct, + DataSourceTypes, + HasStatusCode, + idToBn, + PostData, + PostWithSomeDetails, +} from 'src/types' import { DfImage } from '../../utils/DfImage' import { DfMd } from '../../utils/DfMd' import Section from '../../utils/Section' @@ -205,12 +212,13 @@ const InnerPostPage: NextPage = props => { {titleMsg} )} - {image && ( + {image ? (
+ ) : ( + link && )} - {link && } {body && } @@ -290,13 +298,15 @@ export async function loadPostOnNextReq({ async function getPost() { const replyIds = await blockchain.getReplyIdsByPostId(idToBn(postId!)) const ids = replyIds.concat(postId!) - await dispatch(fetchPosts({ - api: subsocial, - ids, - reload: true, - eagerLoadHandles: true, - dataSource: source === 'chain' ? DataSourceTypes.CHAIN : DataSourceTypes.SQUID - })) + await dispatch( + fetchPosts({ + api: subsocial, + ids, + reload: true, + eagerLoadHandles: true, + dataSource: source === 'chain' ? DataSourceTypes.CHAIN : DataSourceTypes.SQUID, + }), + ) } await Promise.all([getPost(), dispatch(fetchBlockedResources({ appId }))]) const postData = selectPost(reduxStore.getState(), { id: postId }) diff --git a/src/rtk/app/helpers.ts b/src/rtk/app/helpers.ts index 848e4c59f..de7b9f53a 100644 --- a/src/rtk/app/helpers.ts +++ b/src/rtk/app/helpers.ts @@ -122,9 +122,12 @@ function toParamsAndIds({ id, ...params }: CommonFetchPropsAndId): CommonFetchPr } export function validateDataSource(dataSource: DataSourceTypes | undefined) { - if (!dataSource || !config.enableSquidDataSource) { + if (!config.enableSquidDataSource) { dataSource = DataSourceTypes.CHAIN } + if (!dataSource) { + dataSource = DataSourceTypes.SQUID + } return dataSource }