Replies: 1 comment 1 reply
|
This looks like a race in your own caching line rather than in Shiki or VitePress's highlighter itself: markdown ??= await createMarkdownRenderer(...)
The fix is to cache the promise itself, not the awaited value, so every caller gets the same in-flight (or resolved) promise instead of each one racing to create their own: let markdownPromise: Promise<MarkdownRenderer> | undefined;
export function initMarkdownRenderer(): Promise<MarkdownRenderer> {
markdownPromise ??= createMarkdownRenderer(
FILE_PATH_API_DOCS,
vitepressConfig.markdown,
'/'
);
return markdownPromise;
}Here |
Uh oh!
There was an error while loading. Please reload this page.
I have random/flaky (~1%) CI failures in one of my actions:
https://github.com/faker-js/faker/actions/runs/27549969244/job/81433308467
What could be the cause of different "light" colors? (vitest md->html snapshot test)
I use vitepress's markdown renderer directly since I have to use the markdown inside a Vue component of mine.
It looks like a race condition inside the markdown/vitepress setup, but I'm not sure where/what.
In case of the error, the code block seems to use less colors than the normal snapshots.
Does anybody know what could cause this/where to look? I already asked over at vitepress, but they didn't know either.
All reactions