From c30637fcff14c08dcd8b0c0939fced7c8e6dd0b6 Mon Sep 17 00:00:00 2001 From: Muhammad Adeel Tajamul <77053848+muhammadadeeltajamul@users.noreply.github.com> Date: Fri, 22 Jul 2022 15:07:32 +0500 Subject: [PATCH] fix: load thread if thread data doesnot exist in redux (#215) Co-authored-by: adeel.tajamul --- src/discussions/comments/CommentsView.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/discussions/comments/CommentsView.jsx b/src/discussions/comments/CommentsView.jsx index b26d9566..c9f60121 100644 --- a/src/discussions/comments/CommentsView.jsx +++ b/src/discussions/comments/CommentsView.jsx @@ -11,7 +11,7 @@ import { EndorsementStatus, ThreadType } from '../../data/constants'; import { useDispatchWithState } from '../../data/hooks'; import { Post } from '../posts'; import { selectThread } from '../posts/data/selectors'; -import { markThreadAsRead } from '../posts/data/thunks'; +import { fetchThread, markThreadAsRead } from '../posts/data/thunks'; import { selectThreadComments, selectThreadCurrentPage, selectThreadHasMorePages } from './data/selectors'; import { fetchThreadComments } from './data/thunks'; import { Comment, ResponseEditor } from './comment'; @@ -112,7 +112,9 @@ DiscussionCommentsView.propTypes = { function CommentsView({ intl }) { const { postId } = useParams(); const thread = usePost(postId); + const dispatch = useDispatch(); if (!thread) { + dispatch(fetchThread(postId)); return ( );