mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
optimized node layout rerenders
This commit is contained in:
parent
16af90fd50
commit
948817e8fc
7 changed files with 2954 additions and 2933 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { FC, useMemo } from 'react';
|
||||
import React, { FC, useMemo, memo } from 'react';
|
||||
import { Comment } from '../Comment';
|
||||
import { Filler } from '~/components/containers/Filler';
|
||||
|
||||
|
@ -10,7 +10,7 @@ interface IProps {
|
|||
comments?: IComment[];
|
||||
}
|
||||
|
||||
const NodeComments: FC<IProps> = ({ comments }) => {
|
||||
const NodeComments: FC<IProps> = memo(({ comments }) => {
|
||||
const groupped: ICommentGroup[] = useMemo(() => comments.reduce(groupCommentsByUser, []), [
|
||||
comments,
|
||||
]);
|
||||
|
@ -24,6 +24,6 @@ const NodeComments: FC<IProps> = ({ comments }) => {
|
|||
<Filler />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export { NodeComments };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue