1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 14:16:41 +07:00

99 use swr (#100)

* 99: made node use SWR

* 99: fixed comments for SWR node

* 99: added error toast to useNodeFormFormik.ts
This commit is contained in:
muerwre 2022-01-02 17:10:21 +07:00 committed by GitHub
parent 832386d39a
commit c2d1c2bfc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 366 additions and 413 deletions

View file

@ -8,8 +8,9 @@ import classNames from 'classnames';
import { NEW_COMMENT_CLASSNAME } from '~/constants/comment';
type IProps = HTMLAttributes<HTMLDivElement> & {
is_empty?: boolean;
is_loading?: boolean;
nodeId: number;
isEmpty?: boolean;
isLoading?: boolean;
group: ICommentGroup;
isSame?: boolean;
canEdit?: boolean;
@ -20,9 +21,10 @@ type IProps = HTMLAttributes<HTMLDivElement> & {
const Comment: FC<IProps> = memo(
({
group,
is_empty,
nodeId,
isEmpty,
isSame,
is_loading,
isLoading,
className,
canEdit,
onDelete,
@ -34,8 +36,8 @@ const Comment: FC<IProps> = memo(
className={classNames(className, {
[NEW_COMMENT_CLASSNAME]: group.hasNew,
})}
isEmpty={is_empty}
isLoading={is_loading}
isEmpty={isEmpty}
isLoading={isLoading}
user={group.user}
isNew={group.hasNew && !isSame}
{...props}
@ -48,9 +50,10 @@ const Comment: FC<IProps> = memo(
return (
<CommentContent
nodeId={nodeId}
comment={comment}
key={comment.id}
can_edit={!!canEdit}
canEdit={!!canEdit}
onDelete={onDelete}
onShowImageModal={onShowImageModal}
/>