-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Improvements around page transition animations #117
Comments
I've created small minimum repo containing example of implementation without At first I thought either I suggest and so if there is The catch is that ideally for pages without if a user wants to implement loading indicator with for example useAsync() then so my question to maintainers is, can |
I was also thinking that. Vike actually already awaits |
Why is this the case? Why is Page with Suspense -> show the suspense fallback Isn't this the desired behavior? Why do we want to show the loading bar on a page that has suspense? |
So it seems that, if there isn't any
Yea, if the page has suspense then I also think that we don't need to show the loading bar. The only exception being Main |
I checked it again and I think it works only in dev mode, after everything is built and run in prod it does throw errror after client side navigation to the page with I have tried it with my own example, and also |
Defer next page + loading bar
A neat page transition is to preserve the current page and defer showing the next page until it's fully loaded, while showing a loading bar (like YouTube or nprogress). I think it's already possible for the user to implement this?
How about we make this the default behavior?
Default
Currently,
vike-react
doesn't provide any default page transition strategy, but I think it should. (While enabling the user to override this default.)<Suspense>
How about pages that have suspense? (More precisely: when the next page has one or multiple
<Suspense>
boundaries.) In particular when usingvike-react-query
andvike-react-apollo
.With @nitedani we already have ideas about this (
withFallback()
and a new setting+Loading.js
).Main
<Suspense>
How about this: let the user declare the "main"
<Suspense>
boundary. As long as this main suspense isn't resolved then keep showing the old page with a loading bar. As soon as this main suspense is resolved, then show the next page (consequently showing all suspense boundaries that are still loading).For example, a product page would start to be shown to the user upon page navigation only after the product content of the page is fetched from the database.
In other words, it's blocking the rendering the next page. API example:
There could be several
await()
components for a single page. (Although, in the (vast?) majority of cases, the user would likely define only oneawait()
component.)I ain't sure how an implemention would look like, but IIRC React 18/17 introduced a new feature that was addressing this use case. (Start rendering the next page in a seperate virtual DOM while preserving the current page.)
No
<Suspense>
What should happen when there isn't any
<Suspense>
boundary? (Which is also possible withvike-react-{query,apollo}
when the user doesn't useuseFallback()
.) I guess this is the default behavior, i.e. defer showing the next page + loading bar.See also
The text was updated successfully, but these errors were encountered: