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

Use view transitions #376

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Use view transitions #376

wants to merge 4 commits into from

Conversation

nickrttn
Copy link
Contributor

@nickrttn nickrttn commented Aug 14, 2023

Adds Astro's implementation of View Transitions. I haven't enabled any actual page navigation animation because the default crossfade was not very visually pleasing and I don't think we want something like slide effects for tus.io.

Enabling this without actual animations still has some benefits, namely full client side routing after the initial load of the page. That amounts to no more full page reloads when clicking links which is a nice benefit.

@nqst if you feel like playing around with full page transitions, to see if you can get them to look nice, that'd be a nice addition here! I think adding a <div /> around the <slot /> component in src/layouts/default.astro should be a good place to add animation directives, which you can find out more about here: https://docs.astro.build/en/guides/view-transitions/#built-in-animation-directives. If you don't have the time, don't worry, it's not a priority at all, just something fun to play with.

@nickrttn nickrttn requested review from nqst and Acconut August 14, 2023 06:46
@nqst
Copy link
Contributor

nqst commented Aug 16, 2023

I just checked locally how it looks with the animations, and I honestly think that it works/looks much better without any :) Just a quick switch between pages seems nice and familiar to me.

Few questions:

  • Does using View Transitions mean that the browser won't show the loading progress? If so, we might need to add some GitHub-like thin progress bar at the very top of each page to indicate the loading.
  • Not sure if it's related, but I see a rate limit error each time I try to open http://localhost:3000/support. Also, the Back button won't take me back to the previous page from the error page.
Screenshot 2023-08-16 at 15 45 38@2x

@nickrttn
Copy link
Contributor Author

I just checked locally how it looks with the animations, and I honestly think that it works/looks much better without any :) Just a quick switch between pages seems nice and familiar to me.

All good, let's keep transitions out for now :)

Does using View Transitions mean that the browser won't show the loading progress? If so, we might need to add some GitHub-like thin progress bar at the very top of each page to indicate the loading.

In theory, navigations are instantaneous with View Transitions enabled because pages are prefetched. I also didn't see anything about being able to access the loading state of a page so not sure if this is possible.

Not sure if it's related, but I see a rate limit error each time I try to open http://localhost:3000/support. Also, the Back button won't take me back to the previous page from the error page.

This is likely communication with the GitHub API being rate-limited. Without a token, you have only a limited amount of requests you can make before hitting it, and we do a lot of requests to fetch all the contributor data. You should be able to add a .env file containing a GITHUB_TOKEN environment variable. This page tells you how to get one.

# Conflicts:
#	package.json
#	yarn.lock
@nqst
Copy link
Contributor

nqst commented Aug 17, 2023

Thanks for the explanation, Nick! Just one thing:

In theory, navigations are instantaneous with View Transitions enabled because pages are prefetched.

Is this applicable to the blog posts as well? I mean, will all the blog posts be prefetched too? If there are many or if they're content-heavy, that might not be ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants