From 2d0253a4b8366ab4406abe303a68a5adca96c057 Mon Sep 17 00:00:00 2001 From: MerlinScheurer Date: Mon, 8 Dec 2025 23:26:47 +0100 Subject: [PATCH] Fix and ignore new Eslint react rules for now --- frontend/src/components/Filterbar.tsx | 1 + frontend/src/components/VideoPlayer.tsx | 3 +++ frontend/src/pages/Playlist.tsx | 1 - frontend/src/pages/Search.tsx | 15 ++++++++------- frontend/src/pages/SettingsApplication.tsx | 2 ++ frontend/src/pages/SettingsScheduling.tsx | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/Filterbar.tsx b/frontend/src/components/Filterbar.tsx index 95f3c8f9..24bc0999 100644 --- a/frontend/src/components/Filterbar.tsx +++ b/frontend/src/components/Filterbar.tsx @@ -60,6 +60,7 @@ const Filterbar = ({ } if (currentViewStyle === ViewStylesEnum.Table) { + // eslint-disable-next-line react-hooks/set-state-in-effect setShowHidden(true); } else { setShowHidden(false); diff --git a/frontend/src/components/VideoPlayer.tsx b/frontend/src/components/VideoPlayer.tsx index f0ef79d6..b4660dac 100644 --- a/frontend/src/components/VideoPlayer.tsx +++ b/frontend/src/components/VideoPlayer.tsx @@ -146,6 +146,7 @@ const VideoPlayer = ({ } if (setSeekToTimestamp) setSeekToTimestamp(undefined); window.scroll(0, 0); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [seekToTimestamp]); const [searchParams] = useSearchParams(); @@ -389,6 +390,7 @@ const VideoPlayer = ({ } else if (!theaterModePressed) { setTheaterModeKeyPressed(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [theaterModePressed, isTheaterMode, theaterModeKeyPressed]); useEffect(() => { @@ -401,6 +403,7 @@ const VideoPlayer = ({ infoDialog('Normal mode'); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [escapePressed, isTheaterMode]); return ( diff --git a/frontend/src/pages/Playlist.tsx b/frontend/src/pages/Playlist.tsx index 910b3205..45f2bdee 100644 --- a/frontend/src/pages/Playlist.tsx +++ b/frontend/src/pages/Playlist.tsx @@ -108,7 +108,6 @@ const Playlist = () => { } setRefresh(false); })(); - // eslint-disable-next-line react-hooks/exhaustive-deps }, [ playlistId, userConfig.hide_watched_playlist, diff --git a/frontend/src/pages/Search.tsx b/frontend/src/pages/Search.tsx index 6af56508..47fcce9a 100644 --- a/frontend/src/pages/Search.tsx +++ b/frontend/src/pages/Search.tsx @@ -65,6 +65,13 @@ const Search = () => { const gridView = isGridView ? `boxed-${gridItems}` : ''; const gridViewGrid = isGridView ? `grid-${gridItems}` : ''; + const fetchResults = async (searchQuery: string) => { + const searchResults = await loadSearch(searchQuery); + + setSearchResults(searchResults); + setRefresh(false); + }; + useEffect(() => { const handler = setTimeout(() => { setDebouncedSearchTerm(searchTerm); @@ -77,19 +84,13 @@ const Search = () => { useEffect(() => { if (debouncedSearchTerm.trim() !== '') { + // eslint-disable-next-line react-hooks/set-state-in-effect fetchResults(debouncedSearchTerm); } else { setSearchResults(EmptySearchResponse); } }, [debouncedSearchTerm, refresh, videoId]); - const fetchResults = async (searchQuery: string) => { - const searchResults = await loadSearch(searchQuery); - - setSearchResults(searchResults); - setRefresh(false); - }; - return ( <> TubeArchivist diff --git a/frontend/src/pages/SettingsApplication.tsx b/frontend/src/pages/SettingsApplication.tsx index e7ceea37..238f6610 100644 --- a/frontend/src/pages/SettingsApplication.tsx +++ b/frontend/src/pages/SettingsApplication.tsx @@ -182,11 +182,13 @@ const SettingsApplication = () => { }; useEffect(() => { + // eslint-disable-next-line react-hooks/set-state-in-effect fetchData(); }, []); useEffect(() => { if (refresh) { + // eslint-disable-next-line react-hooks/set-state-in-effect fetchData(); setRefresh(false); } diff --git a/frontend/src/pages/SettingsScheduling.tsx b/frontend/src/pages/SettingsScheduling.tsx index 5d8084da..a5a0dd9b 100644 --- a/frontend/src/pages/SettingsScheduling.tsx +++ b/frontend/src/pages/SettingsScheduling.tsx @@ -103,6 +103,7 @@ const SettingsScheduling = () => { }, [refresh]); useEffect(() => { + // eslint-disable-next-line react-hooks/set-state-in-effect setRefresh(true); }, []);