1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 06:41:17 -04:00

lengthen cache-control headers

This commit is contained in:
2022-05-02 10:29:01 -04:00
parent d8d7d7d775
commit 64303400a4
10 changed files with 36 additions and 27 deletions

View File

@@ -10,10 +10,17 @@ export type HitCounterProps = {
const HitCounter = ({ slug, className }: HitCounterProps) => {
// start fetching repos from API immediately
const { data, error } = useSWR(`/api/hits/?slug=${encodeURIComponent(slug)}`, fetcher, {
// avoid double (or more) counting views
revalidateOnFocus: false,
});
const { data, error } = useSWR(
`/api/hits/?${new URLSearchParams({
slug,
})}`,
fetcher,
{
// avoid double (or more) counting views
revalidateOnFocus: false,
revalidateOnReconnect: false,
}
);
// show spinning loading indicator if data isn't fetched yet
if (!data) {