N
Nuxt2y ago
Shiri

SWR problem (or cache problem)

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 },
},
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
10 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Shiri
ShiriOP2y ago
Sadly no, I move to another task and left it open for later.
Shiri
ShiriOP2y ago
they still have both in doc. Isr looks like its the same but for CND
No description
Shiri
ShiriOP2y ago
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
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Shiri
ShiriOP2y ago
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.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Shiri
ShiriOP2y ago
It's should be all the routes. * - means any rote after /, ** - means any rote + any nested rote but maybe i'm mistaken
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Shiri
ShiriOP2y ago
yes
Want results from more Discord servers?
Add your server