Next.js Discord

Discord Forum

Can unstable_cache functions be prefetched at build time? | v14

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Avatar
Barbary LionOP
I have a page that fetches long loading data depending on some filters. Is there a way I can preload all possible data by calling all functions that are wrapped with unstable_cache?

8 Replies

Avatar
lol - what kind of filters did you mean?
I never heard of it btw
Avatar
Barbary LionOP
page numbers, categories, time periods, sorting etc.
Avatar
Sloth bear
If you're using unstable_cache, therefore you're rendering data on server-side. Therefore what point is for preloading?
Preloading may be a good idea when you're using Browser API to fetch an API (on client-side).
Avatar
well, it's a bad idea to preload all possible data
never heard of that approach for filtering
Avatar
No its not possible via the unstable_cache method itself. You need to visit the website for the first time right after build to preload the data