diff --git a/src/pages/index.tsx b/src/pages/index.tsx index aa72f21..933b646 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -4,7 +4,6 @@ import { Analytics } from "@vercel/analytics/react"; import Head from "next/head"; import { useRouter } from "next/router"; import { useKeyboardShortcut } from "../hooks/useKeyboardShortcut"; -import { useState } from "react"; const fetcher = (url: RequestInfo | URL) => fetch(url).then((res) => res.json()); @@ -12,22 +11,10 @@ const fetcher = (url: RequestInfo | URL) => export default function Gif() { const router = useRouter(); - const [isRealError, setIsRealError] = useState(false); - // Check for new image every 1 second - const { data, error } = useSWR("/api/getConfig", fetcher, { + const { data } = useSWR("/api/getConfig", fetcher, { refreshInterval: 1000, keepPreviousData: true, - shouldRetryOnError: true, - onErrorRetry: (error, key, config, revalidate, { retryCount }) => { - if (retryCount < 10) { - setIsRealError(false); - } else { - setIsRealError(true); - } - // Retry every second - setTimeout(() => revalidate({ retryCount }), 5000); - }, }); // Take user to panel when keybind detected @@ -37,41 +24,6 @@ export default function Gif() { useKeyboardShortcut(["ctrl", "p"], goToPanel); - // If data grab fails, show sad face - if (error && isRealError) - return ( -
-
- - - - - - -

Something went wrong. Try again later

-
-
- ); - // While data is loading, show loading animation if (!data) return (