-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Describe the issue you're facing
When setting the version key of ISbStoryParams explicitly to "published", the SDK caches responses from some paths and only returns those, even if new data has been published.
When version is not set (and so is published-only implicitly) this issue does not occur and live published data is accessible immediately.
Reproduction
https://stackblitz.com/edit/stackblitz-starters-gwo9au?file=pages%2F%5B%5B...slug%5D%5D.tsx
Steps to reproduce
Put some code like the following in your getStaticPaths(), with fallback as blocking and reasonably short revalidate:
const sbParams: ISbStoryParams = {
version: preview ? "draft" : "published",
language: locale,
};
// Fetch page content
const storyblokApi = getStoryblokApi();
const { data: pageData } = await storyblokApi.get(
`cdn/stories/${slug}`,
sbParams
);
// Redirect if page is a redirect
if (pageData.story.content.component === 'redirect') {
return {
redirect: {
destination: pageData.story.content.url.cached_url,
permanent: false,
},
};
}
// Fetch global content
const { data: navigationData } = await storyblokApi.get(
`cdn/stories/_global/navigation`,
sbParams
);
pageData always seems to return up to date data, however, navigationData only returns the data that was published and live at build time.
If the version key is removed from sbParams, the navigationData is always up to date. Similarly, version set to "draft" also remains up to date with correct draft/unpublished data.
System Info
System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (28) x64 Intel(R) Core(TM) i7-14700K
Memory: 4.11 GB / 31.13 GB
Container: Yes
Shell: 3.3.1 - /usr/bin/fish
Binaries:
Node: 21.6.0 - ~/.nvm/versions/node/v21.6.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v21.6.0/bin/npm
Browsers:
Chrome: 127.0.6533.72Used Package Manager
yarn
Error logs (Optional)
No response
Validations
- Follow our Code of Conduct