diff --git a/ui/component/livestreamComments/view.jsx b/ui/component/livestreamComments/view.jsx index b606c7f85..931af568a 100644 --- a/ui/component/livestreamComments/view.jsx +++ b/ui/component/livestreamComments/view.jsx @@ -37,12 +37,12 @@ export default function LivestreamComments(props: Props) { embed, doCommentSocketConnect, doCommentSocketDisconnect, - comments, // comments in chronological order (oldest first) + comments: commentsByChronologicalOrder, doCommentList, fetchingComments, doSuperChatList, myChannels, - superChats, // superchats organized by tip amount + superChats: superChatsByTipAmount, } = props; let superChatsFiatAmount, superChatsTotalAmount; @@ -52,8 +52,8 @@ export default function LivestreamComments(props: Props) { const [viewMode, setViewMode] = React.useState(VIEW_MODE_CHAT); const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false); const claimId = claim && claim.claim_id; - const commentsLength = comments && comments.length; - const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? comments : superChats; + const commentsLength = commentsByChronologicalOrder && commentsByChronologicalOrder.length; + const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? commentsByChronologicalOrder : superChatsByTipAmount; const discussionElement = document.querySelector('.livestream__comments'); const commentElement = document.querySelector('.livestream-comment'); @@ -104,10 +104,10 @@ export default function LivestreamComments(props: Props) { }, [commentsLength, discussionElement, handleScroll, performedInitialScroll, setPerformedInitialScroll]); // sum total amounts for fiat tips and lbc tips - if (superChats) { + if (superChatsByTipAmount) { let fiatAmount = 0; let LBCAmount = 0; - for (const superChat of superChats) { + for (const superChat of superChatsByTipAmount) { if (superChat.is_fiat) { fiatAmount = fiatAmount + superChat.support_amount; } else { @@ -121,8 +121,8 @@ export default function LivestreamComments(props: Props) { let superChatsReversed; // array of superchats organized by fiat or not first, then support amount - if (superChats) { - const clonedSuperchats = JSON.parse(JSON.stringify(superChats)); + if (superChatsByTipAmount) { + const clonedSuperchats = JSON.parse(JSON.stringify(superChatsByTipAmount)); // sort by fiat first then by support amount superChatsReversed = clonedSuperchats.sort(function(a, b) { @@ -202,16 +202,16 @@ export default function LivestreamComments(props: Props) { )} <> - {fetchingComments && !comments && ( + {fetchingComments && !commentsByChronologicalOrder && (