-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: add retainBody option to the glob() loader
#15022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: fe1513f The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #15022 will not alter performanceComparing Summary
Footnotes |
|
Would it make sense to have this enabled by default in Astro 6? |
matthewp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocked as a minor change.
|
@matthewp yeah, I was going to suggest that |
|
While thinking about content store size, it would be good to get #14315 over the line too. Even with an option like this, at some point things can get too big, so chunking feels like a good solution to that general problem. |
|
@delucis yeah, it needs some manual testing and benchmarking though. I would like to be confident it doesn't cause performance regressions. |
commit: |
Thanks. Hopefully it works! While this option is a nice one for advanced optimizations, the “Hit limit => discover obscure option => double check you’re not actually using body anywhere” flow is not the nicest DX, so if Astro can make it rarer to hit those limits, that might be nice. (Although we could also potentially one day consider defaulting to not storing the |
|
Yes, as @matthewp said, I would suggest we make this the default in Astro 6 |
|
Added this to the 5.17 milestone. Not yet sure when that will be. |
Changes
Adds a new
retainBodyoption to theglob()loader to allow reducing the size of the data store.Currently, the
glob()loader stores the raw body of each content file inentry.body, in addition to the rendered HTML inentry.rendered.html.The
retainBodyoption defaults totrue, but you can set it tofalseto prevent the raw body of content files from being stored in the data store. This significantly reduces the deployed size of the data store and helps avoid hitting size limits for sites with very large collections. This has caused issues for some very large sites, which have hit the maximum JSON string size.The rendered body will still be available in the
entry.rendered.htmlproperty for markdown files, and theentry.filePathproperty will still point to the original file. For MDX collections this will dramatically reduce the size of the collection, as there will no longer be any body retained in the store.When
retainBodyisfalse,entry.bodywill beundefinedinstead of containing the raw file contents.Testing
Docs