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

View file

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