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
+3 -1
View File
@@ -66,7 +66,9 @@ const CopyButton = forwardRef(function CopyButton(
}, timeout);
// cancel timeout to avoid memory leaks if unmounted in the middle of this
return () => clearTimeout(reset);
return () => {
clearTimeout(reset);
};
}, [timeout, copied]);
return (
+11 -4
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) {