Open
Description
Package
next-drupal (NPM package)
Ask the question
Next.JS App Router supports useful custom fetch request options related to caching such as
fetch("https://...", { next: { revalidate: false | 0 | number } })
fetch("https://...", { next: { tags: ['node:1', 'tag:2'] } })
fetch("https://...", { cache: 'force-cache' | 'no-store' })
However it's not clear how or if we can pass those with the fetch requests from next-drupal
requests.
It would be great if we could pass those per request, e.g for JSON:API requests but appears we perhaps can't pass those options at the moment.
I'm currently using "next-drupal": "^2.0.0-beta.0"
Do you have any recommendations on this?
With thanks for the excellent Next.JS and Drupal integration module.
Additional context
- There is an existing type definition in
NextFetchRequestConfig
that may be available to set infetch
init
here https://github.com/chapter-three/next-drupal/blob/main/packages/next-drupal/src/next-drupal-base.ts#L176 - Sample Next.JS type source here: https://fossies.org/linux/next.js/packages/next/types/global.d.ts
- Next.JS Fetch documentation with examples: https://nextjs.org/docs/app/api-reference/functions/fetch