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

Navigation fails when using View Transitions and navigating to pages containing a client:only component #8988

Closed
1 task done
evadecker opened this issue Nov 2, 2023 · 4 comments · Fixed by #9000
Closed
1 task done
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: dev Related to `astro dev` CLI command (scope) feat: view transitions Related to the View Transitions feature (scope)

Comments

@evadecker
Copy link
Contributor

evadecker commented Nov 2, 2023

Astro Info

Astro                    v3.4.3
Node                     v18.18.0
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/react

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

Safari

Describe the Bug

When using View Transitions and attempting to navigate to a page which contains a client:only component, Astro will occasionally fail to navigate to that page, or delay navigation for several seconds without feedback to the user.

Conditions:

  • View Transitions are enabled.
  • The new page contains a framework component set to client:only (I have only tested this using React components, unsure if it applies to other frameworks).

Observed behavior:

  • Astro will not navigate to the new page. (Safari 17.0)
  • Astro will wait several seconds before navigating. (Chrome 118.0.5993.117)
  • Failing to navigate to the new page is most common on the dev server, and seems to occur less frequently when using astro preview or running in production. However, I have also encountered navigation failure on a production site in Safari.
client-load-fail.mov

What's the expected result?

  • Astro will immediately navigate to the new page without delay.
  • If there is an error which prevents Astro from navigating to the new page with View Transitions enabled, an error will display in the console.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-xvhpqg-pz2nzc?file=src%2Flayouts%2FLayout.astro

Participation

  • I am willing to submit a pull request for this issue. (Or to help, at least!)
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 2, 2023
@lilnasy lilnasy added - P4: important Violate documented behavior or significantly impacts performance (priority) feat: view transitions Related to the View Transitions feature (scope) feat: dev Related to `astro dev` CLI command (scope) and removed needs triage Issue needs to be triaged labels Nov 2, 2023
@lilnasy
Copy link
Contributor

lilnasy commented Nov 2, 2023

The error in browser console. Firefox is not affected.
image

@lilnasy lilnasy added - P3: minor bug An edge case that only affects very specific usage (priority) and removed - P4: important Violate documented behavior or significantly impacts performance (priority) labels Nov 2, 2023
@martrapp
Copy link
Member

martrapp commented Nov 4, 2023

Hi @evadecker, I'm sorry that you are getting this error. In DEV mode, we have a pretty expensive handling for navigating to pages with client:only components. Basically, we restart the page in a clean state behind the scenes and wait until it is fully rendered to determine which stylesheets need to be copied from the current page to the new page. This may mean 1 or 2 seconds of overhead.

But it shouldn't lead to errors. I can reproduce the error on Stackblitz in Chrome. However, I have not been able to reproduce the above error outside of Stackblitz. Neither in a local development nor on github-codespaces. However, I don't have Safari either. Do you have a way to confirm that your minimal example triggers this error in another environment that I can reproduce?

Since the above srcdoc error can only occur in DEV, I'm afraid it's not the cause of the production issues you had.

@evadecker
Copy link
Contributor Author

Thanks for the background explanation @martrapp! Is there any way for you to download Safari? That's the browser it happens most consistently in.

@evadecker
Copy link
Contributor Author

Thanks so much for the fix @martrapp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: dev Related to `astro dev` CLI command (scope) feat: view transitions Related to the View Transitions feature (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants