shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.71k stars 312 forks source link

graphql url not cached #490

Open isaacdarcilla opened 10 months ago

isaacdarcilla commented 10 months ago

Summary

graphql not cached, I already added the url in config.

Versions

How To Reproduce

Steps to reproduce the behavior:

  1. Set the runtimeCaching config,
const withPWA = require('next-pwa')({
    dest: "public",
    register: true,
    skipWaiting: true,
    cacheOnFrontEndNav: true,
    scope: '/',
    runtimeCaching: [
        {
            urlPattern: /^http:\/\/localhost:8000\/graphql/,
            handler: 'StaleWhileRevalidate',
            options: {
                cacheName: 'graphql-api-cache',
            },
        },
        {
            urlPattern: /^http:\/\/localhost:8000\/api\/user/,
            handler: 'StaleWhileRevalidate',
            options: {
                cacheName: 'user-api-cache',
            },
        },
    ],
    // disabled: process.env.NODE_ENV === "development",
})
  1. Run npm run build
  2. Run npm run start
  3. Refresh the page online
  4. Refresh the page offline

Expected Behaviors

It should cache the graphql url also

Screenshots

As you can see, only the user-api-cache is cached, and graphql-api-cache is not.

image