Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Head propagation graph walking on new pages #8646

Merged
merged 4 commits into from Sep 25, 2023
Merged

Conversation

matthewp
Copy link
Contributor

Changes

  • We walk the graph when we encounter a module that has head content, such as transition: directives, walking up parents to mark them with metadata in-tree.
  • If you load a page that contains a module with head content, and then later load another page (as happens in dev), we need to check dependencies so that we can mark the new page with the in-tree if needed.
  • Fixes Nesting Astro components prevents transition directives from animating #8392

Testing

Docs

N/A, bug fix

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2023

🦋 Changeset detected

Latest commit: 475600e

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

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 22, 2023
packages/astro/src/vite-plugin-head/index.ts Outdated Show resolved Hide resolved
configureServer(_server) {
server = _server;
},
resolveId(source, importer) {
Copy link
Member

Choose a reason for hiding this comment

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

If we're handling the propagation in resolveId. Could we remove the similar code in the transform hook entirely? Or do they work differently?

Copy link
Contributor Author

@matthewp matthewp Sep 25, 2023

Choose a reason for hiding this comment

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

I was thinking about this... I think we probably could. I don't fully trust the test coverage though. I'd rather leave a TODO and try and remove it later when feeling more brave.

Copy link
Member

Choose a reason for hiding this comment

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

Works for me 👍 Probably worth circle back whenever possible as it touches on perf

@matthewp matthewp merged commit 69fbf95 into main Sep 25, 2023
13 checks passed
@matthewp matthewp deleted the head-prop-sad-face branch September 25, 2023 14:14
@astrobot-houston astrobot-houston mentioned this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nesting Astro components prevents transition directives from animating
3 participants