fix: warn when partials strip component assets#16759
Open
LeSingh1 wants to merge 2 commits into
Open
Conversation
Astro page partials silently drop scoped styles and hoisted scripts when they exist in the rendered component tree. Warn once per partial route when the tree registered head propagators so the loss surfaces in dev and during build. Fixes withastro#11885
🦋 Changeset detectedLatest commit: cf505ce The changes in this PR will be included in the next version bump. This PR includes changesets to release 416 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 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.
Summary
PagesHandlerlifetime (deduped), so dev users see it on first request and prerender users see it once during build.result._metadata.propagators.size > 0afterrenderPage, which is exactly the runtime set populated by components the compiler marked as propagating (i.e. components with scoped<style>or hoisted<script>blocks).SpyLogger+createBasicPipelinehelpers.Fixes #11885
Tests run
astro-scripts test "test/units/**/*.test.ts" --strip-types --teardown ./test/units/teardown.ts— 2622 passing, 0 failingastro-scripts test "test/units/render/**/*.test.ts" --strip-types --teardown ./test/units/teardown.ts— 273 passingastro-scripts test "test/partials*.test.ts" --strip-types --parallel— 3 passing (existing fixtures)test/units/render/partials-warnings.test.ts— 4 passing, covering:biome checkandprettier -cclean on touched files.Docs
No docs change strictly needed — the existing partials docs already describe the stripping behavior, and the warning links back to that section. Happy to add a note there if maintainers prefer.