Skip to content

Commit

Permalink
add loadMDXWithCaching comment
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 3, 2024
1 parent edc71b7 commit 2694260
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/docusaurus-mdx-loader/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ async function loadMDXWithCaching({
// Note: once we introduce RSCs we'll probably have 3 compilations
// Note: we can't use string keys in WeakMap
// But we could eventually use WeakRef for the values
function deleteCacheEntry() {
options.crossCompilerCache?.delete(cacheKey);
}
const deleteCacheEntry = () => options.crossCompilerCache?.delete(cacheKey);

const cacheEntry = options.crossCompilerCache?.get(cacheKey);

Expand Down Expand Up @@ -187,7 +185,9 @@ async function loadMDXWithCaching({
});
}
return promise;
} else if (compilerName === 'server') {
}
// Server compilation always uses the result of the client compilation above
else if (compilerName === 'server') {
if (cacheEntry) {
deleteCacheEntry();
return cacheEntry.promise;
Expand Down

0 comments on commit 2694260

Please sign in to comment.