#SWR problem (or cache problem)

16 messages · Page 1 of 1 (latest)

gentle copper
#

Hello, I have a problem on my website with cached content. Can somebody explaine me how the SWR should work or where is my problem.
I have a blog with articles, articles are fetched by useAsyncData from API. When I do change in the article in the backend the change is visible when I use router within the app (cliend side). But when I go directly to the URL (SSR) it shows old content (from the First time I visited it).
My routeRules is set like this:

routeRules: {
   "/**": { swr: 60 },
 },```
With this, I assumed it should update after 60 second after first visit (or even maybe in between on background), but it wont.
Can somebody explane to me where is the problem? Or did I get working of SWR wrong? Using Nuxt 3.5.1 with Nitro 2.4.1
burnt talon
#

Are you able to solve it mate?

ruby moat
#

not sure if already in 3.5.1 instead of swr u have to use isr: 60

gentle copper
gentle copper
#

or do I tinking of it that wrong? I'm running it on my own VPS not Netlify or Vercel. So I taught I have to suppose to use swr

ruby moat
#

As far as I know when I did use it for the first time it was supported only on Netlify

#

not even Vercel

#

maybe there are custom wrappers to have it working with redis or something similar

#

but I am not aware of such

gentle copper
#

oh, ok.

#

In documentation of nitro, there is metioned that it uses memory driver to store the cachce. I guess its auto imported by nuxt/nitro so I don't need to do that. Or am I wrong? Really cant find any reason why it should not work. It's a real bummer.

burnt talon
#

With /** are all the routes will be isr? or it's only the root ?

gentle copper
#

but maybe i'm mistaken

burnt talon