Return empty array rather than null from selectRepliesForParentId

This commit is contained in:
David Granado 2022-01-26 08:25:43 -06:00 committed by Thomas Zarebczan
parent 7dfbe5a539
commit cab4b3aba8
2 changed files with 2 additions and 2 deletions

View file

@ -46,7 +46,7 @@ function CommentsReplies(props: Props) {
const [commentsToDisplay, setCommentsToDisplay] = React.useState(fetchedReplies); const [commentsToDisplay, setCommentsToDisplay] = React.useState(fetchedReplies);
const isResolvingReplies = fetchedReplies && resolvedReplies.length !== fetchedReplies.length; const isResolvingReplies = fetchedReplies && resolvedReplies.length !== fetchedReplies.length;
const alreadyResolved = !isResolvingReplies && resolvedReplies.length !== 0; const alreadyResolved = !isResolvingReplies && resolvedReplies.length !== 0;
const canDisplayComments = commentsToDisplay && commentsToDisplay.length === fetchedReplies?.length; const canDisplayComments = commentsToDisplay && commentsToDisplay.length === fetchedReplies.length;
// Batch resolve comment channel urls // Batch resolve comment channel urls
React.useEffect(() => { React.useEffect(() => {

View file

@ -245,7 +245,7 @@ export const selectRepliesForParentId = createCachedSelector(
(id, repliesByParentId, commentsById, ...filterInputs) => { (id, repliesByParentId, commentsById, ...filterInputs) => {
// const claimId = byUri[uri]; // just parentId (id) // const claimId = byUri[uri]; // just parentId (id)
const replyIdsForParent = repliesByParentId[id] || []; const replyIdsForParent = repliesByParentId[id] || [];
if (!replyIdsForParent.length) return null; if (!replyIdsForParent.length) return [];
const comments = []; const comments = [];
replyIdsForParent.forEach((cid) => { replyIdsForParent.forEach((cid) => {