Closed codeflorist closed 3 weeks ago
I see, there is already an upsteam-issue regarding this. I also commented there: https://github.com/storyblok/storyblok-js-client/issues/823
I have been annoyed with this problem for more than half a year. I think this should really be fixed. Currently you always have to perform a new deployment/server restart to make the published changes visible on the server side.
Thank you @codeflorist for analyzing so deeply to identify this problem.
Hi @codeflorist we just merged https://github.com/storyblok/storyblok-js-client/pull/847, this potentially solves this issue, could you test it when the nuxt module version bump is propagated?
Hey @alvarosabu, this looks good now. 👍 Many thanks and have a nice day!
Describe the issue you're facing
Problems with API requests for
published
stories delivering stale content have been reported for quite a while. An example would be #55. They also get reported every several weeks in the Discord - not only regarding Nuxt SDK, but e.g. also by nextjs users.It is reproducable with Storyblok's official Quickstart Demo Stackblitz (https://stackblitz.com/edit/nuxt-3-quickstart-demo). Using
version: 'draft'
, everything works fine, but if it is changed topublished
, no backend changes will be reflected on reload. This is indev
andSSR build
environments.I believe the culprit lies with
storyblok-js-client
, specifically thisif
-statement: https://github.com/storyblok/storyblok-js-client/blob/3592e384637659112d710fe59fe216130dab0350/src/index.ts#L632I believe this means, a cache-flush is only performed, if
draft
versions are requested. Otherwise i guess the response will stay in memory-cache forever.I don't know the purpose of limiting the flush-behaviour to
draft
requests. If it is unwanted ot a bug, imho it should be removed.Also notable: On the page https://www.storyblok.com/tp/optimize-your-caching-strategy-with-storyblok it is stated, that with any SDK using
storyblok-js-client
cache invalidation should be taken care of automatically, which seems to be the case fordraft
, but notpublished
requests.Reproduction
https://stackblitz.com/edit/nuxt-3-quickstart-demo
Steps to reproduce
version: 'draft'
toversion: 'published'
inindex.vue
.home
to/
(as described in the tutorial)version: 'draft'
.System Info
Used Package Manager
npm
Error logs (Optional)
No response
Validations