SWR on Vercel
Hi, I'm trying to setup SWR site on Vercel. The problem is I keep seeing requests to API being made, when navigating using NuxtLink. I did set payloadExtraction to true, but it doesn't seem to help.
Here is the config:
experimental: {
payloadExtraction: true
},
routeRules: {
// all routes (by default) will be revalidated every 60 seconds, in the background
'/**': { swr: 60 }
}
I do this, because there is an external API, that I call by /api/* in Nuxt app and it is very slow (1-2s response time). I would like my page to be fast - it would make sense to regenerate it once in a while (now it's set to 60 sec for testing), since that data isn't updated very often, but I keep getting no data, when requests are made again on client side. I guess this happens, because I use query parameters, that are undefined
with SWR enabled (but that request shouldn't go through anyway right?).1 Reply
One solution would be to make NuxtLink external - then it gets prerendered version which has correct data, but that doesn't feel like best option to me.