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

Consolidate inline hydration scripts into one #3244

Merged
merged 5 commits into from
May 3, 2022

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Apr 30, 2022

Changes

  • Removes the one script tag per hydrated component code.
  • Replaces with a single script that defines a custom element that does what the individual script tags used to do, using attributes to know what to load.
  • Renames astro-root to astro-island.
  • The astroId mostly goes away with this method. It's still needed for HMR, but this should close out issues related to the astroId not matching.

Testing

  • All tests updated to confirm there is one script tag for hydration, not N.
  • Also manually tested against examples, including SSR.

Docs

N/A, implementation detail.

@changeset-bot
Copy link

changeset-bot bot commented Apr 30, 2022

🦋 Changeset detected

Latest commit: 71f3694

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

This PR includes changesets to release 1 package
Name Type
astro 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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) feat: markdown Related to Markdown (scope) test labels Apr 30, 2022
@matthewp matthewp marked this pull request as ready for review April 30, 2022 11:30
Copy link
Contributor

@bholmesdev bholmesdev left a comment

Choose a reason for hiding this comment

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

Noticed a funny variable name (maybe from a bad refactor). Otherwise looks hydradone to me!

@matthewp matthewp merged commit 48a35e6 into main May 3, 2022
@matthewp matthewp deleted the get-rid-of-hydration-scripts branch May 3, 2022 13:07
@github-actions github-actions bot mentioned this pull request May 3, 2022
matthewp added a commit that referenced this pull request May 3, 2022
matthewp added a commit that referenced this pull request May 3, 2022
matthewp added a commit that referenced this pull request May 3, 2022
* Revert "Consolidate inline hydration scripts into one (#3244)"

This reverts commit 48a35e6.

* Fix types

* Adds changeset
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* Consolidate inline hydration scripts into one

* Adds changeset

* Update custom element test

* Provide a better name for tracking if we have added a hydration script
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
…" (withastro#3275)

* Revert "Consolidate inline hydration scripts into one (withastro#3244)"

This reverts commit 48a35e6.

* Fix types

* Adds changeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: markdown Related to Markdown (scope) pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants