Fix expansion broken with layout change
This commit is contained in:
parent
58db9576b9
commit
a3302b1be8
1 changed files with 4 additions and 3 deletions
|
@ -87,6 +87,7 @@ function CommentList(props: Props) {
|
||||||
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const isMediumScreen = useIsMediumScreen();
|
const isMediumScreen = useIsMediumScreen();
|
||||||
|
const desktopView = !isMobile && !isMediumScreen;
|
||||||
const spinnerRef = React.useRef();
|
const spinnerRef = React.useRef();
|
||||||
const DEFAULT_SORT = ENABLE_COMMENT_REACTIONS ? SORT_BY.POPULARITY : SORT_BY.NEWEST;
|
const DEFAULT_SORT = ENABLE_COMMENT_REACTIONS ? SORT_BY.POPULARITY : SORT_BY.NEWEST;
|
||||||
const [sort, setSort] = usePersistedState('comment-sort-by', DEFAULT_SORT);
|
const [sort, setSort] = usePersistedState('comment-sort-by', DEFAULT_SORT);
|
||||||
|
@ -94,7 +95,7 @@ function CommentList(props: Props) {
|
||||||
const fetchedCommentsOnce = useFetched(isFetchingComments);
|
const fetchedCommentsOnce = useFetched(isFetchingComments);
|
||||||
const fetchedReactsOnce = useFetched(isFetchingReacts);
|
const fetchedReactsOnce = useFetched(isFetchingReacts);
|
||||||
const fetchedLinkedComment = useFetched(isFetchingCommentsById);
|
const fetchedLinkedComment = useFetched(isFetchingCommentsById);
|
||||||
const hasDefaultExpansion = commentsAreExpanded || (!isMobile && !isMediumScreen);
|
const hasDefaultExpansion = commentsAreExpanded || desktopView;
|
||||||
const [expandedComments, setExpandedComments] = React.useState(hasDefaultExpansion);
|
const [expandedComments, setExpandedComments] = React.useState(hasDefaultExpansion);
|
||||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||||
const channelId = getChannelIdFromClaim(claim);
|
const channelId = getChannelIdFromClaim(claim);
|
||||||
|
@ -307,8 +308,8 @@ function CommentList(props: Props) {
|
||||||
|
|
||||||
<ul
|
<ul
|
||||||
className={classnames({
|
className={classnames({
|
||||||
comments: expandedComments,
|
comments: desktopView || expandedComments,
|
||||||
'comments--contracted': !expandedComments,
|
'comments--contracted': !desktopView && !expandedComments,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{readyToDisplayComments && pinnedComments && getCommentElems(pinnedComments)}
|
{readyToDisplayComments && pinnedComments && getCommentElems(pinnedComments)}
|
||||||
|
|
Loading…
Reference in a new issue