-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bf35ab
commit f708b9d
Showing
3 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,9 @@ | |
"react-dom", | ||
"vite" | ||
] | ||
}, | ||
"patchedDependencies": { | ||
"astro@2.0.17": "patches/astro@2.0.17.patch" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff --git a/dist/content/internal.js b/dist/content/internal.js | ||
index 697a57cdce15610a422f9a42e861f2f4d7d99737..cb9f11759651c0516ee4bbc2334e1c137e5f3bac 100644 | ||
--- a/dist/content/internal.js | ||
+++ b/dist/content/internal.js | ||
@@ -28,12 +28,17 @@ function createCollectionToGlobResultMap({ | ||
} | ||
return collectionToGlobResultMap; | ||
} | ||
+const cacheByCollection = new Map(); | ||
function createGetCollection({ | ||
collectionToEntryMap, | ||
collectionToRenderEntryMap | ||
}) { | ||
return async function getCollection(collection, filter) { | ||
const lazyImports = Object.values(collectionToEntryMap[collection] ?? {}); | ||
+ // TODO: cache on prod builds only | ||
+ if (cacheByCollection.has(collection)) { | ||
+ return cacheByCollection.get(collection); | ||
+ } | ||
const entries = Promise.all( | ||
lazyImports.map(async (lazyImport) => { | ||
const entry = await lazyImport(); | ||
@@ -53,6 +58,7 @@ function createGetCollection({ | ||
}; | ||
}) | ||
); | ||
+ cacheByCollection.set(collection, entries); | ||
if (typeof filter === "function") { | ||
return (await entries).filter(filter); | ||
} else { |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.