Parse <StarlightPage /> frontmatter asynchronously #2279
Merged
delucis merged 1 commit intowithastro:mainfrom Sep 4, 2024
Merged
Parse <StarlightPage /> frontmatter asynchronously #2279delucis merged 1 commit intowithastro:mainfrom
<StarlightPage /> frontmatter asynchronously #2279delucis merged 1 commit intowithastro:mainfrom
Conversation
🦋 Changeset detectedLatest commit: cf7fbd5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
HiDeoo
added a commit
to HiDeoo/starlight
that referenced
this pull request
Sep 7, 2024
* main: (37 commits) [ci] format i18n(ko-KR): update `manual-setup.mdx` (withastro#2294) i18n(ko-KR): update `configuration.mdx` (withastro#2295) [ci] release (withastro#2292) Add support for SSR (withastro#1255) Add Markdoc preset and example (withastro#2249) Refactor sidebar persistence logic for better slow device performance (withastro#2242) [ci] format Add docs.ryzekit.com to showcase (withastro#2291) Update astro dependency to 4.15.3 across monorepo (withastro#2289) [ci] release (withastro#2290) Prevent Zod errors from crashing build (withastro#2288) i18n(fr): update `guides/css-and-tailwind` (withastro#2286) i18n(ko-KR): update `css-and-tailwind.mdx` (withastro#2284) Add WCAG AAA colour contrast option to theme editor (withastro#2282) [ci] release (withastro#2283) Parse `<StarlightPage />` frontmatter asynchronously (withastro#2279) Ensure unhandled directives are restored without any extra whitespace (withastro#2281) i18n(fr): update `resources/plugins` (withastro#2278) i18n(ko-KR): update `plugins.mdx` (withastro#2277) ...
Yoxnear
pushed a commit
to Yoxnear/starlight-custom
that referenced
this pull request
Jul 23, 2025
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.

Description
frontmattercontaining typereference()causes an error in pages that use the<StarlightPage />component. #2270This PR updates how the frontmatter data passed down to the
<StarlightPage />component is parsed. Starting with Astro 4.14.0, schemas containing collection references contains an async transform which would failed to be parsed due to our usage of ZodsafeParse()instead ofsafeParseAsync().I decided to create a new
parseAsyncWithFriendlyErrors()instead of always parsing schemas asynchrounously asparseWithFriendlyErrors()is used in the pluginsetuphookupdateConfigoption and I did not want to change that behavior. The new function is now only used in this specific case.Regarding testing, I decided to not add a test as we cannot really easily have a unit test with a custom schema using
extendand having an E2E test for this would require using a different Astro version. Creating a unit test simply callingparseAsyncWithFriendlyErrors()with a schema containing an async refinement or transform doesn't provide much value imo. Let me know if you think otherwise.Altho, I used the reproduction in #2270 and tested the fix using Astro
4.13.4and the latest version and both are now working as expected.