Fix styles silently dropped when await is used in .astro template markup#17228
Merged
Conversation
…nt (#17218)\n\nWhen a slot function contains expressions in the template, it returns\na Promise. The AstroComponentInstance constructor called slots eagerly for\npropagation registration but didn't track async results. This caused\npropagating components (like Content with styles) inside async slots to not\nbe registered before bufferPropagatedHead ran, silently dropping their styles.\n\nThe fix tracks async slot pre-render promises on SSRMetadata and awaits them\nin bufferPropagatedHead before collecting head parts.
1 task
🦋 Changeset detectedLatest commit: 828df1e 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 |
|
Interesting that the perf. degraded by so much. One guess I have for making this more performant again is to extract the values in the |
Member
|
I think the regression is a flake, it popped up in another PR too. |
ematipico
approved these changes
Jun 29, 2026
Merged
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
<style>tags from propagating components (e.g. content collectionContentwithpropagation: 'self') were silently dropped from the build output whenawaitappeared in the template/markup section of an.astrofile. Moving theawaitto the frontmatter was the only workaround.AstroComponentInstancepre-renders slots eagerly to trigger propagator registration, but when a slot function is async it returns a Promise.bufferPropagatedHeadran before the Promise resolved, collecting zero propagators and dropping their styles.pendingSlotEvaluationsfield ofSSRMetadata.bufferPropagatedHeadawaits them all before collecting head parts.Closes #17218
Testing
'awaits pending async slot evaluations before collecting head parts'topackages/astro/test/units/render/head-propagation/runtime.test.ts. It pushes a delayed Promise that registers a propagator, then verifiesbufferPropagatedHeadwaits for it and collects the resulting style tag.runtime-adapters.test.tsandserver-islands-render.test.tsfixtures to include the newpendingSlotEvaluationsfield onSSRMetadata.Docs
No docs update needed — this is a bug fix restoring already-documented behavior (styles from components should always be collected regardless of where
awaitappears).