storyblok-nuxt
storyblok-nuxt copied to clipboard
useAsyncStoryblok does not work with resolve_relations as expected
According the docs on https://github.com/storyblok/storyblok-nuxt#2-getting-storyblok-stories-and-listen-to-visual-editor-events the composition api composable useAsyncStoryblok
"is the short-hand equivalent to using useStoryblokApi inside useAsyncData and useStoryblokBridge functions separately" which i cannot confirm as i get different results.
When i use useAsyncStoryblok
i get the direct story data:
whereas when using useStoryblokApi
i get an object which contains a story object but also other objects like rels and so on:
So i get different data structures on both solutions. From a "short-hand equivalent" i would expect same behaviour.
Currently i need to load a story and resolve its relations. I did it as described here: https://www.storyblok.com/tp/create-and-render-blog-articles-in-storyblok-and-nuxt
but the result is only the story data, but not the rels object.
When i request it directly over browser url: https://api.storyblok.com/v2/cdn/stories/angebot/appartements?language=de&version=draft&token=246y8yrGbIXVFeVVWldUnQtt&resolve_relations=AppartementReference.appartements i get the result as expected. the overall object including story and relations.
When i request by using useStoryblokApi
it is the same, i get the same results.
Only when using useAsyncStoryblok
i don't get the rels object, but regarding the documentation it should be there, as it is saying: "Resolved stories will be shown in a rels array at the end of the JSON response."
Expected Behavior
i would expect rels to be part of my useAsyncStoryblok
response.
i would expect useAsyncStoryblok
and useStoryblokApi
to deliver same data structure
Current Behavior
Even when following the documentation and official coding example i am not able to get the relations object over useAsyncStoryblok
Steps to Reproduce
- open the stackblitz https://stackblitz.com/edit/nuxt-starter-aelmwe?file=package.json,nuxt.config.ts,app.vue
- see reproduction in app.vue
- have a look what is print out in dev tools console