#Remix-utils cacheAssets hook

1 messages · Page 1 of 1 (latest)

gritty haven
#

Hello! I am trying to increase the page load performance, and I was recommended to try this hook from remix-utils

https://github.com/sergiodxa/remix-utils?tab=readme-ov-file#cacheassets

My understanding was that this is something most modern browsers already did.

Does this do anything the browser doesn't? Or is it more insurance to make sure everything possible caches. Is it generally recommended to use?

Thanks!

GitHub

A set of utility functions and types to use with Remix.run - GitHub - sergiodxa/remix-utils: A set of utility functions and types to use with Remix.run

mental cedar
#

The cacheAssets function will grab the complete list of assets from Remix manifest and put them in cache, on a new document page it will compare the already cached one to the manifest again to either cache again something that expired or was manually removed, add new assets that were added after a deploy and remove assets that are not used anymore

#

so while browsers will cache the assets as you use them, this will do it all at once

#

if your app is used for long sessions (imagine Trello, Discord, Slack, etc.) I think using this to cache everything once it's great so after the browser cache everything navigations will not require downloading more files, only the data

#

if your app is not used for long session, e.g. a blog, a landing, etc. then this could cause the browser to load many files that the app may never need