chapter-three / next-drupal

Next.js for Drupal has everything you need to build a next-generation front-end for your Drupal site: SSG, SSR, and ISR, Multi-site, Authentication, Webforms, Search API, I18n and Preview mode (works with JSON:API and GraphQL).
https://next-drupal.org
MIT License
634 stars 176 forks source link

Add Next Cache Option to Fetch #809

Open backlineint opened 6 days ago

backlineint commented 6 days ago

Package

next-drupal (NPM package)

Describe the feature request

Currently it is not possible to specify the cache option when using fetch with the Next Drupal client.

Next.js 15 increases the priority for this as it flips the caching semantics to be uncached by default: https://nextjs.org/blog/next-15#caching-semantics Although I'm not sure how much of a problem this is in practice as the docs state:

As a convenience, it is not necessary to set the cache option if revalidate is set to a number.

So that would cover path based revalidation with revalidate. I would hope that the same thing happens if you use the tags option, but would have to test to confirm. Regardless it is still confusing for us to not have a way to directly control this cache option that Next exposes.

Describe the solution you'd like

Additional context

This is starting to make our withCache option even more confusing. I continue to wonder if that should be deprecated in the future.

backlineint commented 6 days ago

This might also be an opportunity to clean up our types - possibly supporting all options allowed by fetch.