From 19b838a84bfc7216052a08af85edb705772695f4 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Mon, 9 Sep 2024 11:51:03 +0700 Subject: [PATCH] feat: change name of swr --- .../src/components/launches/calendar.context.tsx | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/apps/frontend/src/components/launches/calendar.context.tsx b/apps/frontend/src/components/launches/calendar.context.tsx index d37b2ce1..2eb28c62 100644 --- a/apps/frontend/src/components/launches/calendar.context.tsx +++ b/apps/frontend/src/components/launches/calendar.context.tsx @@ -79,19 +79,8 @@ export const CalendarWeekProvider: FC<{ }> = ({ children, integrations }) => { const fetch = useFetch(); const [internalData, setInternalData] = useState([] as any[]); - const [trendings, setTrendings] = useState([]); - const { mutate } = useSWRConfig(); + const [trendings] = useState([]); const searchParams = useSearchParams(); - const router = useRouter(); - - useEffect(() => { - (async () => { - if (isGeneral()) { - return []; - } - setTrendings(await (await fetch('/posts/predict-trending')).json()); - })(); - }, []); const display = searchParams.get('month') ? 'month' : 'week'; const [filters, setFilters] = useState({ @@ -127,7 +116,7 @@ export const CalendarWeekProvider: FC<{ [filters, params] ); - const swr = useSWR(`/posts`, loadData, { + const swr = useSWR(`/posts-${params}`, loadData, { refreshInterval: 3600000, refreshWhenOffline: false, refreshWhenHidden: false,