mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-09-06 02:55:38 -04:00
lengthen cache-control headers
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user