From daf956024440f2de4440f39ede006ae1b346b4d8 Mon Sep 17 00:00:00 2001 From: Gresille&Siffle <39056254+GresilleSiffle@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:03:18 +0100 Subject: [PATCH] front: fix initialization of a PaginatedContributorRatingList --- frontend/src/pages/videos/VideoRatings.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/videos/VideoRatings.tsx b/frontend/src/pages/videos/VideoRatings.tsx index f348a79329..be7ae2d40c 100644 --- a/frontend/src/pages/videos/VideoRatings.tsx +++ b/frontend/src/pages/videos/VideoRatings.tsx @@ -44,7 +44,10 @@ const NoRatingMessage = ({ hasFilter }: { hasFilter: boolean }) => { const VideoRatingsPage = () => { const { name: pollName, options } = useCurrentPoll(); - const [ratings, setRatings] = useState({}); + const [ratings, setRatings] = useState({ + count: 0, + results: [], + }); const [isLoading, setIsLoading] = useState(true); const location = useLocation(); const history = useHistory(); @@ -52,7 +55,6 @@ const VideoRatingsPage = () => { const searchParams = new URLSearchParams(location.search); const limit = 20; const offset = Number(searchParams.get('offset') || 0); - const videoCount = ratings.count || 0; const hasFilter = searchParams.get('isPublic') != null; const handleOffsetChange = (newOffset: number) => { @@ -119,10 +121,10 @@ const VideoRatingsPage = () => { displayContextAlert={true} /> - {!isLoading && videoCount > 0 && videoCount > limit && ( + {!isLoading && ratings.count > 0 && ratings.count > limit && (