wait for channel fetch for reactions fetch

This commit is contained in:
jessop 2020-10-02 17:17:12 -04:00 committed by Sean Yesmunt
parent ae191afeec
commit d4df1c8384
2 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { makeSelectClaimIsMine, selectMyChannelClaims } from 'lbry-redux';
import { makeSelectClaimIsMine, selectFetchingMyChannels, selectMyChannelClaims } from 'lbry-redux';
import {
makeSelectTopLevelCommentsForUri,
selectIsFetchingComments,
@ -16,6 +16,7 @@ const select = (state, props) => ({
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
isFetchingComments: selectIsFetchingComments(state),
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
fetchingChannels: selectFetchingMyChannels(state),
});
const perform = dispatch => ({

View file

@ -19,6 +19,7 @@ type Props = {
isFetchingComments: boolean,
linkedComment: any,
totalComments: number,
fetchingChannels: boolean,
};
function CommentList(props: Props) {
@ -32,6 +33,7 @@ function CommentList(props: Props) {
isFetchingComments,
linkedComment,
totalComments,
fetchingChannels,
} = props;
const commentRef = React.useRef();
@ -65,10 +67,10 @@ function CommentList(props: Props) {
}, [fetchComments, uri]);
useEffect(() => {
if (totalComments && ENABLE_COMMENT_REACTIONS) {
if (totalComments && ENABLE_COMMENT_REACTIONS && !fetchingChannels) {
fetchReacts(uri);
}
}, [fetchReacts, uri, totalComments, activeChannel, ENABLE_COMMENT_REACTIONS]);
}, [fetchReacts, uri, totalComments, activeChannel, fetchingChannels, ENABLE_COMMENT_REACTIONS]);
useEffect(() => {
if (linkedCommentId && commentRef && commentRef.current) {