Repository navigation
Resolve content collection images without cloning entry data - #17631
Conversation
Record image field locations when an entry is stored, so read-time resolution rewrites only those fields instead of deep-cloning the whole entry. Values elsewhere are passed through by reference, so a schema transform returning a Temporal.PlainDate or other class instance no longer throws DataCloneError.
🦋 Changeset detectedLatest commit: 01230cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 417 packages
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 |
|
This is a much cleaner direction than making the clone smarter like #17596 did — recording the image field paths at write time (where the data is already being traversed anyway) and doing a copy-on-write only along those paths means Astro never has to take a position on what types user data may contain. Happy for this to supersede my PR. Two things I noticed while reading the diff, mostly as questions:
Thanks for picking this up so quickly! |
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [@astrojs/markdown-remark](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/markdown/remark)) | [`7.2.2` → `7.2.3`](https://renovatebot.com/diffs/npm/@astrojs%2fmarkdown-remark/7.2.2/7.2.3) |  |  | | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`7.2.2` → `7.2.3`](https://renovatebot.com/diffs/npm/astro/7.2.2/7.2.3) |  |  | --- ### Release Notes <details> <summary>withastro/astro (@​astrojs/markdown-remark)</summary> ### [`v7.2.3`](https://github.com/withastro/astro/blob/HEAD/packages/markdown/remark/CHANGELOG.md#723) [Compare Source](https://github.com/withastro/astro/compare/@astrojs/[email protected]...@astrojs/[email protected]) ##### Patch Changes - Updated dependencies \[[`8c193f6`](withastro/astro@8c193f6)]: - [@​astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@​0.10.3 </details> <details> <summary>withastro/astro (astro)</summary> ### [`v7.2.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#723) [Compare Source](https://github.com/withastro/astro/compare/[email protected]@7.2.3) ##### Patch Changes - [#​17724](withastro/astro#17724) [`97140b2`](withastro/astro@97140b2) Thanks [@​ematipico](https://github.com/ematipico)! - Fixes an issue where Astro could run out of memory when `experimental.collectionStorage` is set to `chunked` and there are multiple concurrent updates to the same collection. - [#​17636](withastro/astro#17636) [`51723b1`](withastro/astro@51723b1) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes the dev server sometimes matching against stale routes after pages were added, removed, or renamed, requiring a dev server restart to pick up the change - [#​17636](withastro/astro#17636) [`51723b1`](withastro/astro@51723b1) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes the composable request helpers (`astro/fetch`) throwing an error when used on a request that had been rewritten with `Astro.rewrite()` or `next()` - [#​17636](withastro/astro#17636) [`51723b1`](withastro/astro@51723b1) Thanks [@​matthewp](https://github.com/matthewp)! - Refactors Astro's internal server-side request handling. This is an internal change: all documented public APIs, including `App` and `NodeApp`, keep their existing signatures and behavior. The undocumented internal `app.pipeline` property and the `AppPipeline` export from `astro/app` have been removed. Adapters that used `app.pipeline.getLogger()` to wait for the configured log destination can call the new `app.getLogger()` instead. As a result of this refactor, `new FetchState(request)` from `astro/fetch` now works anywhere inside a built Astro server — including custom `src/fetch.ts` entrypoints — without the request needing to first pass through `app.render()`. Previously this threw an error, breaking patterns like the Cloudflare adapter's advanced custom-worker setup. - [#​17723](withastro/astro#17723) [`c3b9aed`](withastro/astro@c3b9aed) Thanks [@​florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a link in font providers JSDoc annotations - [#​17699](withastro/astro#17699) [`e28d227`](withastro/astro@e28d227) Thanks [@​ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes several documentation issues related to the JSDoc for configuration options. - When hovering over the `server` and `fonts` options, the JSDoc for the nested options was displayed instead of the JSDoc for the top-level property. - Two i18n configuration options were being used incorrectly in the examples. - The indentation of some code blocks was broken on hover. - [#​17572](withastro/astro#17572) [`2066f39`](withastro/astro@2066f39) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes a crash when a request arrives with a malformed port in the `Host` header (for example `example.com:65536` or `example.com:8080:8080`). Such a host made the constructed request URL invalid, and the fallback that was meant to recover reused the same invalid host and threw again. The request URL now degrades to a host the server controls when the incoming host cannot be parsed, so the request is handled instead of erroring. - [#​17685](withastro/astro#17685) [`9f15609`](withastro/astro@9f15609) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes a dev server error where an SSR full reload triggered by a third-party Vite plugin (such as `@tailwindcss/vite`) could fail with `Failed to load url astro:server-app.js` - [#​17636](withastro/astro#17636) [`51723b1`](withastro/astro@51723b1) Thanks [@​matthewp](https://github.com/matthewp)! - Improves error handling for custom log destinations. When the configured logger fails to load, Astro now reports the error and continues with the default console logger instead of failing the first request. - [#​17631](withastro/astro#17631) [`cf29bec`](withastro/astro@cf29bec) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes `getCollection()` and `getEntry()` throwing `DataCloneError` when a collection schema transform returns a `Temporal.PlainDate` or other class instance. - Updated dependencies \[[`8c193f6`](withastro/astro@8c193f6)]: - [@​astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@​0.10.3 - [@​astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@​7.2.3 - [@​astrojs/markdown-satteri](https://github.com/astrojs/markdown-satteri)@​0.3.6 </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4zMS4wIiwidXBkYXRlZEluVmVyIjoiNDQuMzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Changes
Temporal.PlainDateor other class instance no longer throwsDataCloneErrorfromgetCollection()/getEntry().structuredCloneusage, so any types supported bydevalue()should work.Testing
image-references.test.ts: reworked, removed old testsmutable-data-store.test.ts: asserts image prefixes are stripped to plain srcs and their paths recorded asimageImports, and that entries without images record nothing.Docs
Alternative to #17596.
Closes #17589