Repository navigation
Fix getCollection() returning empty in dev mode for large content collections - #17223
Merged
Merged
Conversation
… support large collections in dev mode
1 task
🦋 Changeset detectedLatest commit: c850c31 The changes in this PR will be included in the next version bump. This PR includes changesets to release 393 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 |
Contributor
|
I think there's a reason we use dataToESM so I'm not sure about this fix. |
Only swap dataToEsm() for a runtime JSON.parse() of a string literal in dev when the serialized store exceeds 5MB, so production and normal-sized dev stores keep the original object-literal output. Measure the threshold in UTF-8 bytes so multi-byte content (e.g. CJK) is not undercounted. Restores the @rollup/pluginutils dependency since build still uses dataToEsm().
Contributor
|
Changed it to only use this approach on large stores and only in dev, where this problem can occur. |
matthewp
approved these changes
Jun 29, 2026
dadezzz
pushed a commit
to dadezzz/university_notes
that referenced
this pull request
Jul 4, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`7.0.3` → `7.0.4`](https://renovatebot.com/diffs/npm/astro/7.0.3/7.0.4) |  |  | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v7.0.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#704) [Compare Source](https://github.com/withastro/astro/compare/[email protected]@7.0.4) ##### Patch Changes - [#​17212](withastro/astro#17212) [`7ba0bb1`](withastro/astro@7ba0bb1) Thanks [@​matthewp](https://github.com/matthewp)! - Ensures transition directive values are HTML-escaped when rendered on hydrated islands - [#​17224](withastro/astro#17224) [`dc5e52f`](withastro/astro@dc5e52f) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes trailing slash handling for dynamic file endpoints in dev mode. Dynamic file endpoints (e.g., `src/pages/api/[name].json.ts`) with `trailingSlash: "always"` incorrectly required a trailing slash in dev mode, returning 404 for `/api/bar.json` and 200 for `/api/bar.json/`. - [#​17067](withastro/astro#17067) [`23f9446`](withastro/astro@23f9446) Thanks [@​fkatsuhiro](https://github.com/fkatsuhiro)! - Fixed a bug where the development toolbar did not output a warning even though the implicit ARIA role and the manually specified role were duplicated. - [#​17234](withastro/astro#17234) [`d5fbee8`](withastro/astro@d5fbee8) Thanks [@​ocavue](https://github.com/ocavue)! - Adds support for [`sharp` v0.35](https://github.com/lovell/sharp/releases/tag/v0.35.0). pnpm users no longer need to approve `sharp`'s build script (see [`allowBuilds`](https://pnpm.io/settings#allowbuilds)) when on v0.35. - [#​17223](withastro/astro#17223) [`5970ef4`](withastro/astro@5970ef4) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes `getCollection()` returning empty in dev mode for large content collections (500k+ entries) - [#​17184](withastro/astro#17184) [`799e5cd`](withastro/astro@799e5cd) Thanks [@​Princesseuh](https://github.com/Princesseuh)! - Upgrades the Rust compiler to the latest, which fixes some bugs. Refer to its [changelog](https://github.com/withastro/compiler-rs/releases/tag/%40astrojs%2Fcompiler-rs%400.3.0) for more information. - [#​17208](withastro/astro#17208) [`da8b573`](withastro/astro@da8b573) Thanks [@​matthewp](https://github.com/matthewp)! - Hardens forwarded header handling so the internal request helper validates `X-Forwarded-Host` against `security.allowedDomains` before trusting `X-Forwarded-For` for `clientAddress`. Previously it only checked that the header was present, which was inconsistent with the public `createRequest` helper. This aligns both code paths; behavior is unchanged for correctly configured proxies. </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 this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDYuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI0Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
3 of 11 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
getCollection()in dev mode silently returned an empty array for content collections with ~500k+ entries. The virtual module for the data store useddataToEsm()to serialize the store as a JS object literal, which for large collections produces ~7.5MB of JS source. Vite'sssrTransformScriptpassed this to rolldown/oxc-parser'sparseAstAsync(), whose resulting AST was too large to cross the NAPI bridge — throwing"Failed to convert rust String into napi string", silently caught inImmutableDataStore.fromModule(), returning an empty store.dataToEsm(parsed, { compact: true })withexport default JSON.parse(${JSON.stringify(jsonData)}). This embeds the data as a single string literal, keeping the AST tiny regardless of collection size. As a bonus,JSON.parse()of a string literal is faster to evaluate than a large object literal. Removed the now-unuseddataToEsmimport.Testing
Docs
Closes #17220