Next.js Discord

Discord Forum

Next's Fetch Extension and Pages Router?

Unanswered
Oriental Cuckoo posted this in #help-forum
Open in Discord
Oriental CuckooOP
Are the caching features available with Next's fetch extension available if used with the Pages Router in getServerSideProps?

8 Replies

Giant panda
No.
For that you can use the built-in ISR capabilities of the pages router.
Oriental CuckooOP
I'm trying to do some component level server side data fetching and since I'm isolated to a component, I'm sometimes fetching the data multiple times on a page and need a caching mechanism.
app router fetch is perfect for this.
Giant panda
Component level server-side data fetching doesn't exist in the pages router.
Because data is only fetched in gSSP and gSP
Oriental CuckooOP
Most headless CMSs have workaround sdks for this, using a second rendering, context and middleware.
Its super awkward and much easier in app router, but I was hoping to use fetch caching. I guess Ill have to use something else if you are sure its not usable. I don't want to store it on that Headless CMS context or create another context but I guess Ill have to.