Fix bug where comments would not update when edited

This commit is contained in:
Aaron William Po
2023-05-02 19:50:36 -04:00
parent e505db94b0
commit 23baa68a25
3 changed files with 7 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ const BeerPostCommentsSection: FC<BeerPostCommentsSectionProps> = ({ beerPost })
pageSize={PAGE_SIZE}
setSize={setSize}
size={size}
mutate={mutate}
/>
)
}

View File

@@ -134,6 +134,7 @@ const BreweryCommentsSection: FC<BreweryBeerSectionProps> = ({ breweryPost }) =>
setSize={setSize}
size={size}
commentSectionRef={commentSectionRef}
mutate={mutate}
/>
)
}

View File

@@ -1,6 +1,6 @@
import { FC, MutableRefObject } from 'react';
import { FaArrowUp } from 'react-icons/fa';
import { mutate } from 'swr';
import { useInView } from 'react-intersection-observer';
import useBeerPostComments from '@/hooks/useBeerPostComments';
@@ -25,6 +25,9 @@ interface CommentsComponentProps {
isLoadingMore: ReturnType<
typeof useBeerPostComments | typeof useBreweryPostComments
>['isLoadingMore'];
mutate: ReturnType<
typeof useBeerPostComments | typeof useBreweryPostComments
>['mutate'];
}
const CommentsComponent: FC<CommentsComponentProps> = ({
@@ -35,6 +38,7 @@ const CommentsComponent: FC<CommentsComponentProps> = ({
pageSize,
setSize,
size,
mutate,
}) => {
const { ref: penultimateCommentRef } = useInView({
/**