Skip to content

Commit 04e7fe0

Browse files
author
Shannon Anahata
committed
fixes hot reload for Shannon and hopefully others
1 parent 0a90e2a commit 04e7fe0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mdx.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,11 +702,14 @@ const fileBySlugCache = new Map<string, Promise<SlugFile>>();
702702
* This is useful for performance when rendering the same file multiple times.
703703
*/
704704
export function getFileBySlugWithCache(slug: string): Promise<SlugFile> {
705+
if (process.env.NODE_ENV === 'development') {
706+
// Bypass the cache in development to ensure hot reload works for MDX files
707+
return getFileBySlug(slug);
708+
}
705709
let cached = fileBySlugCache.get(slug);
706710
if (!cached) {
707711
cached = getFileBySlug(slug);
708712
fileBySlugCache.set(slug, cached);
709713
}
710-
711714
return cached;
712715
}

0 commit comments

Comments
 (0)