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

ViewTransitions animations do not work with Server Islands #12406

Closed
1 task
jonaspm opened this issue Nov 8, 2024 · 6 comments
Closed
1 task

ViewTransitions animations do not work with Server Islands #12406

jonaspm opened this issue Nov 8, 2024 · 6 comments
Labels
feat: server islands Related to Server Islands (scope) feat: view transitions Related to the View Transitions feature (scope)

Comments

@jonaspm
Copy link

jonaspm commented Nov 8, 2024

Astro Info

ViewTransitions animations do break when server:defer is used.

If this issue only occurs in one browser, which browser is a problem?

Edge

Describe the Bug

ViewTransitions animations do break when server:defer is used.

What's the expected result?

Animations work like in here:
https://spotify-astro-transitions.vercel.app/

Just add server:defer to a component from the example repo and animations won't work.

Link to Minimal Reproducible Example

https://github.com/jonaspm/spotify-astro-transitions

https://stackblitz.com/~/github.com/jonaspm/spotify-astro-transitions

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 8, 2024
@jonaspm jonaspm changed the title Server Islands do not work with View Transition animations Server Islands do not work with ViewTransitions animations Nov 8, 2024
@apatel369
Copy link
Contributor

@jonaspm Your repo uses Astro v3 where server components are not supported. Please provide a reproducible example with a supported Astro version. https://astro.build/blog/astro-4120/

@ematipico ematipico added the needs repro Issue needs a reproduction label Nov 9, 2024
Copy link
Contributor

github-actions bot commented Nov 9, 2024

Hello @jonaspm. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Nov 9, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
@jonaspm
Copy link
Author

jonaspm commented Nov 20, 2024

Please reopen, here is the repository, I have forked and updated to latest dependency versions:

Repo: https://github.com/jonaspm/spotify-astro-transitions

StackBlitz: https://stackblitz.com/~/github.com/jonaspm/spotify-astro-transitions

@jonaspm
Copy link
Author

jonaspm commented Nov 20, 2024

Add or remove server:defer to the file and line: src/pages/index.astro:22.
See attached image as reference:
image

@jonaspm jonaspm changed the title Server Islands do not work with ViewTransitions animations Reopen: Server Islands do not work with ViewTransitions animations Nov 20, 2024
@ematipico ematipico reopened this Nov 21, 2024
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 21, 2024
@ematipico ematipico removed the needs repro Issue needs a reproduction label Nov 21, 2024
@jonaspm jonaspm changed the title Reopen: Server Islands do not work with ViewTransitions animations Server Islands do not work with ViewTransitions animations Nov 21, 2024
@jonaspm jonaspm changed the title Server Islands do not work with ViewTransitions animations ViewTransitions animations do not work with Server Islands Nov 21, 2024
@martrapp
Copy link
Member

martrapp commented Nov 30, 2024

Hi @jonaspm 👋🏼, I’m afraid what you’re aiming for can't work. By the time the server islands load, it’s too late for them to participate in the view transition. When using view transitions, you transitioned already to the new page before the first island will load.

@martrapp martrapp added feat: view transitions Related to the View Transitions feature (scope) feat: server islands Related to Server Islands (scope) and removed needs triage Issue needs to be triaged labels Nov 30, 2024
@martrapp
Copy link
Member

martrapp commented Dec 3, 2024

Hi @jonaspm 👋🏼, I close this issue because we can not meet your expectations. The behavior you observe also matches that of server islands in combination with browser-native cross-document view transitions.

A HTML element that should participate in view transitions must be present in the DOM when the transition starts. You can't achieve this with server islands. Maybe you can craft a custom solution for your use case by redefining the loader within a listener to the astro:before-preparation event.

@martrapp martrapp closed this as completed Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: server islands Related to Server Islands (scope) feat: view transitions Related to the View Transitions feature (scope)
Projects
None yet
Development

No branches or pull requests

4 participants