Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"published" version status serves stale data #1175

Open
1 task done
fiddlie-ed opened this issue Aug 5, 2024 · 1 comment
Open
1 task done

"published" version status serves stale data #1175

fiddlie-ed opened this issue Aug 5, 2024 · 1 comment
Labels
pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised

Comments

@fiddlie-ed
Copy link

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.72

Used Package Manager

yarn

Error logs (Optional)

No response

Validations

@fiddlie-ed fiddlie-ed added pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised labels Aug 5, 2024
@sahmed007
Copy link

I get this same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised
Projects
None yet
Development

No branches or pull requests

2 participants