diff --git a/packages/ui/src/components/markdown.tsx b/packages/ui/src/components/markdown.tsx index f0180599..f6fcd091 100644 --- a/packages/ui/src/components/markdown.tsx +++ b/packages/ui/src/components/markdown.tsx @@ -13,7 +13,10 @@ let markdownModulePromise: Promise | null = null function loadMarkdownModule(): Promise { if (!markdownModulePromise) { - markdownModulePromise = import("../lib/markdown") + markdownModulePromise = import("../lib/markdown").catch((error) => { + markdownModulePromise = null + throw error + }) } return markdownModulePromise } diff --git a/packages/ui/src/lib/markdown.ts b/packages/ui/src/lib/markdown.ts index 4d048516..6d041a1f 100644 --- a/packages/ui/src/lib/markdown.ts +++ b/packages/ui/src/lib/markdown.ts @@ -61,7 +61,10 @@ async function getOrCreateHighlighter() { themes: ["github-light", "github-light-high-contrast", "github-dark"], langs: [], }) - })() + })().catch((error) => { + highlighterPromise = null + throw error + }) highlighter = await highlighterPromise highlighterPromise = null