10up / headstartwp

Build a headless website fast with WordPress, the world’s most popular CMS, and Next.js, the most popular React framework. A free and open source solution by the experts at 10up.
https://headstartwp.10up.com
153 stars 17 forks source link

[App Router] Data Fetching caching strategies in headstartwp.config.js #796

Closed nicholasio closed 3 days ago

nicholasio commented 4 weeks ago

Is your enhancement related to a problem? Please describe.

383 Allows for each query function to specify its own caching strategy. This issue is for providing a way to configure the cache strategy globally in headstartwp.config.js

 fetch: {
   headers: ({fetchStrategy}) => {
        if (fetchStrategy.getEndpoint() === '/wp-json/headless-wp/v1/app') {
           return {
              cache: 'force-cache',
              next: {
                 revalidate: 5 * 60,
              }
           }
        }
        return {};
   }
 }

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

nicholasio commented 3 days ago

I've tought about this and I don't think it makes sense to do this and we can always revisit this later