Skip to content

Stop reloading between page transitions. Improve perceived page speed. #560

Answered by sergiodxa
vladfulgeanu asked this question in General
Discussion options

You must be logged in to vote

Without seeing the code it’s a little hard to be 100% sure hit from what you wrote I understood you are not doing client-side transition to move from lithe feed to the article right? Instead you are reloading. If you reload the internal cache of SWR will be reseted and it will need to fetch again the data.

What I usually do to avoid this is to update the cache directly from localStorage instead of doing it inside the fetcher, this way SWR will give the the cached data immediately, I built a library (https://github.com/sergiodxa/swr-sync-storage) for this use case, you check the code to see how to do it.

Another things is that you may want to solve the server-side transition when moving fr…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@lukebarton
Comment options

@lukebarton
Comment options

@vladfulgeanu
Comment options

Answer selected by vladfulgeanu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants