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

Resolve Relations does not support Releases (from_release param) #863

Open
annieperrier opened this issue Oct 22, 2024 · 0 comments
Open
Labels
bug Something isn't working p3-significant [Priority] Moderate issues, major enhancements

Comments

@annieperrier
Copy link

When requesting a Story from a release (using from_release param) which has a resolve relations, the resolved story is not from the requested release but from the default "Current" release. Content from a release cannot be viewed correctly if it contains referenced stories.


Expected Behavior

When fetching a story from a release using the from_release param, resolved relations should be resolved with stories from the same requested release.

Storyblok.getStory('my-slug',{
  from_release: myReleaseId,
  resolve_relations: "myComponent.myField",
});

Current Behavior

When fetching a story from a release using the from_release param, resolved relations are resolved with stories from the default "Current" release.

Storyblok.getStory('my-slug',{
  from_release: myReleaseId,
  resolve_relations: "myComponent.myField",
});

## Steps to Reproduce

1. Create a story (A) with a reference (Single-Option Field Options: Source: Stories) to another story (B).
2. Create a Release (R) in Storyblok and change some content of story (B) in Release (R)
3. Fetch Story (A) using `getStory` with the `from_release` and `resolve_relations` parameters
4. Story A is correctly returned from the Release (R) but its nested content of Story (B) is the original content from Release (Current) instead of the requested Release (R) in which it has been changed.

## Possible Solution

`src/index.ts`

private async resolveRelations(
//...
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
const relationsRes = await this.getStories({
per_page: chunkSize,
language: params.language,
version: params.version,
from_release: params.from_release, // Add any user-provided release param sent to the original getStory() request
by_uuids: chunks[chunkIndex].join(','),
excluding_fields: params.excluding_fields,
})
// ...


The same may be required for `resolveLinks()`.


Thanks!
@alvarosabu alvarosabu added bug Something isn't working p3-significant [Priority] Moderate issues, major enhancements labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p3-significant [Priority] Moderate issues, major enhancements
Projects
None yet
Development

No branches or pull requests

2 participants