-
Notifications
You must be signed in to change notification settings - Fork 23
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
Non blocking navigation #41
Comments
@pi0 I was going to suggest using |
@addyosmani @pi0 @danielroe |
Hi @anton-karlovskiy. Actually it is nice to also use keep-alive to reuse created dom elements and vue instance. Also it is important to keep reusable data in global state (vuex store or state plugin) this way we can use it across pages and possibly keep only data in memory rather than dom. |
Hi @pi0 |
|
Hi @pi0
I'd like to ask a few questions.
Actually, at the beginning of the project, we dropped Please correct me if I'm wrong. Thank you. |
After replacing After adopting |
@pi0 @danielroe As far as I know, the main reason we need a global state like
If I'm correct, I'd like to continue :) In Vue.js/Nuxt.js development, could we use a similar approach to using SWR with Next.js? For example: https://github.com/Kong/swrv
from @danielroe's notes at #3 (comment) Please correct me if I'm wrong :) Thank you. |
Hi @anton-karlovskiy. I fully agree that using swr fetching for cache would be much better to cache API responses rather than keeping them in global state (vuex or other solution). But consider that we can use a cached response if it was fetched once before. When a new users comes to page A and navigates to B, she/he doesn't have payload for B (even if client side swr cache implemented). So with a non-blocking navigation when goes to page B, should wait for B's payload to be fetched in order to see rendered content while we can smartly reuse part of A's payload (like we already know movie title by it's id and can also start fetching poster image in parallel to payload fetching). This is possible with graphql resolver caching or custom logic for REST apis. In either way this is an optional performance improvement to show meaningful content to user as soon as possible when doing client-side navigation :) |
One of newer features nuxt introduced in v2.12 (it is before original nuxt-movies project created i guess) is
fetch
hook which in comparation toasyncData
, awaits during server-side-rendering but does not blocks route change with client-side navigation. This gives us possibility to quickly navigate to next page while individual parts of page are loading. Which can be by a skeleton but we usually have some vital meta from current page in global state like movie title so can reuse it. (this technique is used in nuxt hackernews demo for example)Action points:
The text was updated successfully, but these errors were encountered: