storyblok / storyblok-astro

Astro SDK for Storyblok CMS
158 stars 29 forks source link

Wrong Return type for useStoryblok() #895

Open samuelemde opened 1 month ago

samuelemde commented 1 month ago

Describe the issue you're facing

When using the new useStoryblok() wrapper to use the live preview in Storyblok, the function only returns the story object. This prevents us from using the assets array returned by setting resolve_assets: 1, because the assets array is on the same level as the story in the original response.

Reproduction

https://stackblitz.com/edit/astro-sdk-demo-s3f9zj?file=src%2Fpages%2Findex.astro

Steps to reproduce

const story = await useStoryblok(`cdn/stories/${slug}`, getFetchParams(version, language), {}, Astro)

// there is no way to access the resolved assets array here

System Info

astro: 4.13.1,
@storyblok/astro: 5.0.0,

Used Package Manager

npm

Error logs (Optional)

No response

Validations

dipankarmaikap commented 1 week ago

Hi @samuelemde,

Thank you for raising this issue. The Astro live preview feature is currently experimental, but we have an upcoming release that will make this process simpler and address the concerns you've mentioned.