From 9c847f492ab54f2ac9a7df2f42fb8311318edaf5 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 7 Mar 2025 10:39:14 +0700 Subject: [PATCH] use videoId for refresh dependency --- frontend/src/pages/ChannelVideo.tsx | 3 +-- frontend/src/pages/Home.tsx | 3 +-- frontend/src/pages/Playlist.tsx | 3 +-- frontend/src/pages/Search.tsx | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/ChannelVideo.tsx b/frontend/src/pages/ChannelVideo.tsx index aa8db33f..2533bebe 100644 --- a/frontend/src/pages/ChannelVideo.tsx +++ b/frontend/src/pages/ChannelVideo.tsx @@ -45,7 +45,6 @@ const ChannelVideo = ({ videoType }: ChannelVideoProps) => { const channel = channelResponse; const videoList = videoResponse?.data; const pagination = videoResponse?.paginate; - const refreshWhenVideoIdChanges = videoId !== null; const hasVideos = videoResponse?.data?.length !== 0; @@ -81,7 +80,7 @@ const ChannelVideo = ({ videoType }: ChannelVideoProps) => { channelId, pagination?.current_page, videoType, - refreshWhenVideoIdChanges, + videoId, ]); if (!channel) { diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index 0d58f410..446e9ab8 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -117,7 +117,6 @@ const Home = () => { const videoList = videoResponse?.data; const pagination = videoResponse?.paginate; const continueVideos = continueVideoResponse?.data; - const refreshWhenVideoIdChanges = videoId !== null; const hasVideos = videoResponse?.data?.length !== 0; @@ -153,7 +152,7 @@ const Home = () => { userConfig.hide_watched, currentPage, pagination?.current_page, - refreshWhenVideoIdChanges, + videoId, ]); return ( diff --git a/frontend/src/pages/Playlist.tsx b/frontend/src/pages/Playlist.tsx index bd4ad549..38f4079e 100644 --- a/frontend/src/pages/Playlist.tsx +++ b/frontend/src/pages/Playlist.tsx @@ -56,7 +56,6 @@ const Playlist = () => { const palylistEntries = playlistResponse?.playlist_entries; const videoArchivedCount = Number(palylistEntries?.filter(video => video.downloaded).length); const videoInPlaylistCount = pagination?.total_hits; - const refreshWhenVideoIdChanges = videoId !== null; const view = userConfig.view_style_home; const gridItems = userConfig.grid_items; @@ -93,7 +92,7 @@ const Playlist = () => { refresh, currentPage, pagination?.current_page, - refreshWhenVideoIdChanges, + videoId, ]); if (!playlistId || !playlist) { diff --git a/frontend/src/pages/Search.tsx b/frontend/src/pages/Search.tsx index 2db6c4f3..111ca82e 100644 --- a/frontend/src/pages/Search.tsx +++ b/frontend/src/pages/Search.tsx @@ -56,7 +56,6 @@ const Search = () => { const playlistList = searchResults?.results.playlist_results; const fulltextList = searchResults?.results.fulltext_results; const queryType = searchResults?.queryType; - const refreshWhenVideoIdChanges = videoId !== null; const hasSearchQuery = searchTerm.length > 0; const hasVideos = Number(videoList?.length) > 0; @@ -90,7 +89,7 @@ const Search = () => { } else { setSearchResults(EmptySearchResponse); } - }, [debouncedSearchTerm, refresh, refreshWhenVideoIdChanges]); + }, [debouncedSearchTerm, refresh, videoId]); const fetchResults = async (searchQuery: string) => { const searchResults = await loadSearch(searchQuery);