Prod build collections cache can be modified #10700
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
feat: content collections
Related to the Content Collections feature (scope)
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When building for production, the first time a collection is loaded it can be manipulated in a way that affects the cache and results in the manipulations carrying over to subsequent calls to getCollection. This doesn't happen when running or building dev.
What's the expected result?
The cached collection should not be affected by operations performed after loading it.
I believe I found the cause is simply line 113 here returning the original array rather than a copy like it does when the cache is used on line 81:
astro/packages/astro/src/content/runtime.ts
Lines 79 to 114 in 8214bac
Link to Minimal Reproducible Example
https://github.com/SStembridge/astro-collections-cache-prod-build
Participation
The text was updated successfully, but these errors were encountered: