1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

fixed comments loader

This commit is contained in:
Fedor Katurov 2022-07-17 13:27:33 +07:00
parent 0a1d2cbf99
commit bb81bdae69
16 changed files with 80 additions and 127 deletions

View file

@ -1,6 +1,7 @@
import React, { FC, memo, useMemo } from 'react';
import { Comment } from '~/components/comment/Comment';
import { LoadMoreButton } from '~/components/input/LoadMoreButton';
import { useGrouppedComments } from '~/hooks/node/useGrouppedComments';
import { ICommentGroup } from '~/types';
import { useCommentContext } from '~/utils/context/CommentContextProvider';
@ -21,6 +22,8 @@ const NodeComments: FC<IProps> = memo(({ order }) => {
const {
comments,
hasMore,
isLoading,
isLoadingMore,
lastSeenCurrent,
onLoadMoreComments,
onDeleteComment,
@ -36,12 +39,10 @@ const NodeComments: FC<IProps> = memo(({ order }) => {
const more = useMemo(
() =>
hasMore && (
<div className={styles.more} onClick={onLoadMoreComments}>
Показать ещё комментарии
</div>
),
[hasMore, onLoadMoreComments]
hasMore && <div className={styles.more}>
<LoadMoreButton isLoading={isLoadingMore} onClick={onLoadMoreComments} />
</div>,
[hasMore, onLoadMoreComments, isLoadingMore]
);
if (!node?.id) {