paint-brush
Make your application more reactive with a client-side cacheby@_Bearfoot
144 reads

Make your application more reactive with a client-side cache

by Wilfried BoukhersMarch 23rd, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Have a single-page or mobile application with intense “Back to the previous list” usage? Are you fetching the exact same data every single time the user is pressing the “back” button?
featured image - Make your application more reactive with a client-side cache
Wilfried Boukhers HackerNoon profile picture

Have a single-page or mobile application with intense “Back to the previous list” usage? Are you fetching the exact same data every single time the user is pressing the “back” button?

In this case, you can improve your application user experience and relieve your API at the same time.

Let’s have a look at some popular application.

On the first image, you can see a list of files and folder. Now, let’s go to docs, that’s the second image. When you come back to the parent folder, the same request that was performed the first time will be performed again, making your application slower and using server resources when it could have remembered the data and displayed it right away, giving the user an instant result.

A word of caution, if you alter the data, or if the data is altered by someone else and if the changes need to be shown, you need to update your cache accordingly. That would be the case for Github.

At the moment, the way I do it is with Apollo Client http://dev.apollodata.com