diff --git a/app/pages/Bookmarks.tsx b/app/pages/Bookmarks.tsx index d92bb50..e3a5c0b 100644 --- a/app/pages/Bookmarks.tsx +++ b/app/pages/Bookmarks.tsx @@ -29,26 +29,29 @@ export function BookmarksPage(props: { profile_id?: number }) { ); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); function useFetchReleases(listName: string) { let url: string; - if (!preferenceStore.params.skipToCategory.enabled) { - if (props.profile_id) { - url = `${ENDPOINTS.user.bookmark}/all/${props.profile_id}/${BookmarksList[listName]}/0?sort=1`; - if (token) { - url += `&token=${token}`; - } - } else { - if (token) { - url = `${ENDPOINTS.user.bookmark}/all/${BookmarksList[listName]}/0?sort=1&token=${token}`; - } - } - - const { data } = useSWR(url, fetcher); - return [data]; + if (preferenceStore.params.skipToCategory.enabled) { + return [null]; } - return [null]; + + if (props.profile_id) { + url = `${ENDPOINTS.user.bookmark}/all/${props.profile_id}/${BookmarksList[listName]}/0?sort=1`; + if (token) { + url += `&token=${token}`; + } + } else { + if (token) { + url = `${ENDPOINTS.user.bookmark}/all/${BookmarksList[listName]}/0?sort=1&token=${token}`; + } + } + + // eslint-disable-next-line react-hooks/rules-of-hooks + const { data } = useSWR(url, fetcher); + return [data]; } useEffect(() => { diff --git a/app/pages/Index.tsx b/app/pages/Index.tsx index efd5073..c40c057 100644 --- a/app/pages/Index.tsx +++ b/app/pages/Index.tsx @@ -23,6 +23,7 @@ export function IndexPage() { if (preferenceStore.params.skipToCategory.enabled) { router.push(`/home/${preferenceStore.params.skipToCategory.homeCategory}`); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { @@ -50,6 +51,7 @@ export function IndexPage() { if (!preferenceStore.params.skipToCategory.enabled) { _loadReleases(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [token]); return ( diff --git a/app/pages/Search.tsx b/app/pages/Search.tsx index bded169..ba68963 100644 --- a/app/pages/Search.tsx +++ b/app/pages/Search.tsx @@ -147,6 +147,7 @@ export function SearchPage() { } setContent(allReleases); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [data]); const scrollPosition = useScrollPosition(); @@ -170,6 +171,7 @@ export function SearchPage() { if (searchVal && searchVal.length % 4 == 1) { _executeSearch(searchVal.trim()); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchVal]); if (error) return