Skip to content

Fix inclusion of viewtransition.css when server:defer was used without transition.* directives#1149

Merged
martrapp merged 3 commits intomainfrom
mt/server-defer-head-propagation
Feb 19, 2026
Merged

Fix inclusion of viewtransition.css when server:defer was used without transition.* directives#1149
martrapp merged 3 commits intomainfrom
mt/server-defer-head-propagation

Conversation

@martrapp
Copy link
Member

@martrapp martrapp commented Feb 19, 2026

Changes

  • Separates server:defer from transition detection in internal/transform/transform.go.
  • doc.Transition + transition scope are now only set when transition:animate, transition:name, or transition:persist are present.
  • Keeps head propagation for server:defer without enabling transition behavior.
  • Adds regression coverage in internal/transform/transform_test.go for:
    • server:defer only → no transition flag, head propagation enabled
    • transition directive cases → transition flag + head propagation enabled

Closes #1148

Testing

Docs

  • No public docs updated (internal compiler behavior fix + test coverage)

Improves confidence in transform metadata by validating how transition and head propagation flags are derived across key directive combinations.

Prevents regressions by confirming that only actual transition directives enable transition handling, while defer-only rendering still preserves head propagation.
Prevents deferred server rendering from being treated as a transition feature.

Keeps head propagation enabled for deferred content, while only transition-specific attributes trigger transition state and related scoping.
@changeset-bot
Copy link

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: 0012bc8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Patch

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

@martrapp martrapp marked this pull request as draft February 19, 2026 14:19
@martrapp martrapp changed the title Mt/server defer head propagation Fix inclusion of viewtransition.css when server:defered was used without transition.* directives Feb 19, 2026
@martrapp martrapp marked this pull request as ready for review February 19, 2026 14:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where server:defer was incorrectly treated as a transition directive, causing unnecessary inclusion of ViewTransitions CSS. The fix separates the handling of server:defer from actual transition directives (transition:animate, transition:name, transition:persist), ensuring that only genuine transition directives set the doc.Transition flag while both can enable head propagation independently.

Changes:

  • Separated server:defer detection from transition directive detection in the transform logic
  • Added comprehensive test coverage for the transition flag and head propagation behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/transform/transform.go Splits the conditional logic to handle server:defer separately from transition directives, preventing it from incorrectly setting doc.Transition
internal/transform/transform_test.go Adds regression tests verifying that server:defer alone doesn't trigger transition behavior while transition directives do
.changeset/brown-tires-melt.md Documents the bug fix in the changelog

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martrapp martrapp changed the title Fix inclusion of viewtransition.css when server:defered was used without transition.* directives Fix inclusion of viewtransition.css when server:defer was used without transition.* directives Feb 19, 2026
@martrapp martrapp merged commit 811e90f into main Feb 19, 2026
10 of 11 checks passed
@martrapp martrapp deleted the mt/server-defer-head-propagation branch February 19, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ViewTransitions.css loaded when a server:defer component is present on a page

3 participants