SSR'd index page not caching
Unanswered
Rex posted this in #help-forum
RexOP
Running into a global issue when i load in on like site.com/dashboard via ssr, and then if my other pages are prefetched, whenever i route to other pages such as site.com/account it loads instantly due to prefetching, but whenever i try to route back to eth original url i loaded in on, (such as site.com/dashboard in this example) then that route is never cached and I always have to wait like the second or so for it to refetch.
and this is happening for all cases for whatever the first page was that i loaded in on.
Anyone experience this or know what might be causing this?
and this is happening for all cases for whatever the first page was that i loaded in on.
Anyone experience this or know what might be causing this?
6 Replies
American black bear
That is the intended behaviour.
Prefetching only occurs when the user hovers a link.
If you want to load your dashboard page faster I suggest you cache the functions responsible for fetching the dynamic data in your dashboard.
For example if you have a page like this:
export default async function DashboardPage() {
// you should look into caching this function so the server does not have to hit the database on every request and instead uses a cached value which is revalidated once every 15 seconds or so depending on how fresh the data needs to be
const dynamicData = await getDynamicData()
return <DynamicDataRenderer data={dynamicData} />
}
@American black bear That is the intended behaviour.
RexOP
ty. will take a look at implementing