Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/hooks/usePendingRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const usePendingRoute = () => {
const [pendingRoute, setPendingRoute] = useState<string | null>(null);
const currentRoute = useRef<string | null>(null);
useEffect(() => {
let routeTransitionTimer: any = null;
let routeTransitionTimer: NodeJS.Timeout | undefined = undefined;

const handleRouteChangeStart = (url: string) => {
clearTimeout(routeTransitionTimer);
if (routeTransitionTimer) clearTimeout(routeTransitionTimer);
routeTransitionTimer = setTimeout(() => {
if (currentRoute.current !== url) {
currentRoute.current = url;
Expand All @@ -30,15 +30,15 @@ const usePendingRoute = () => {
};
const handleRouteChangeComplete = () => {
setPendingRoute(null);
clearTimeout(routeTransitionTimer);
if (routeTransitionTimer) clearTimeout(routeTransitionTimer);
};
events.on('routeChangeStart', handleRouteChangeStart);
events.on('routeChangeComplete', handleRouteChangeComplete);

return () => {
events.off('routeChangeStart', handleRouteChangeStart);
events.off('routeChangeComplete', handleRouteChangeComplete);
clearTimeout(routeTransitionTimer);
if (routeTransitionTimer) clearTimeout(routeTransitionTimer);
};
}, [events]);

Expand Down
10 changes: 1 addition & 9 deletions src/utils/compileMDX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {MDXComponents} from 'components/MDX/MDXComponents';

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~ IMPORTANT: BUMP THIS IF YOU CHANGE ANY CODE BELOW ~~~
const DISK_CACHE_BREAKER = 11;
const DISK_CACHE_BREAKER = 12;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

export default async function compileMDX(
Expand Down Expand Up @@ -45,16 +45,8 @@ export default async function compileMDX(
);
const cached = await store.get(hash);
if (cached) {
console.log(
'Reading compiled MDX for /' + path + ' from ./node_modules/.cache/'
);
return cached;
}
if (process.env.NODE_ENV === 'production') {
console.log(
'Cache miss for MDX for /' + path + ' from ./node_modules/.cache/'
);
}

// If we don't add these fake imports, the MDX compiler
// will insert a bunch of opaque components we can't introspect.
Expand Down