diff --git a/components/Views.tsx b/components/Views.tsx index 2b3d755..7f62412 100644 --- a/components/Views.tsx +++ b/components/Views.tsx @@ -3,7 +3,7 @@ import {ElementType, useEffect} from 'react' import fetcher from '@/lib/fetcher' import {numberFormat} from '@/lib/numberFormat' -type ViewsType = { +type ViewsResponse = { views: string } @@ -17,7 +17,7 @@ type ViewsProps = { const updateViews = (slug: string) => fetcher(`/api/views/${slug}`, {method: 'POST'}) export function Views({as: Component = 'span', slug, className, shouldUpdateViews = true}: ViewsProps) { - const {data} = useSWR(`/api/views/${slug}`, fetcher, { + const {data} = useSWR(`/api/views/${slug}`, fetcher, { revalidateOnFocus: false, revalidateOnMount: true })