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} pageSize={PAGE_SIZE}
setSize={setSize} setSize={setSize}
size={size} size={size}
mutate={mutate}
/> />
) )
} }

View File

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

View File

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