Skip to content

🐛 BUG: Turbolinks breaks hydration on repeat page views #3128

@nonphoto

Description

@nonphoto

What version of astro are you using?

1.0.0-beta.12

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

Turbolinks merges script tags in head and will not run a script more than once, so Astro islands will not hydrate when viewing a page for the second time.

This is only an issue with the Turbolinks integration at the moment. An easy fix would be to add hydration scripts to body instead of head. However, I can imagine other scenarios where it would be useful to insert and remove islands and have hydration handled automatically, so I think using a MutationObserver would be a more general solution.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-kq5z3u?file=src/pages/about.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly impacts performance (priority)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions