Open jrutila opened 6 months ago
Created the PR after all...
thanks - need this too. Also the current implementation loses any error context from the storyblok fetch and doesn't throw any errors too
Hi @jrutila thanks for reaching out! Can you confirm for me if the PR I linked is correct?
Since this introduces a breaking change let me discuss it internally with the team on how would be the best approach. 🙏
Yes, the PR is correct. I implemented some deprecation warning already, but please do discuss it through and change as needed.
Description
In the latest versions
useAsyncStoryblok
returns only the story. You cannot control theuseAsyncData
that is inside theuseAsyncStoryblok
at all. For example, you would like to instruct lazy or client only fetching.To be more in line with the way nuxt composables like
useAsyncData
oruseFetch
work theuseAsyncStoryblok
should return the object that contains the usualdata
,pending
, etc properties. One could also provide theAsyncDataOptions
for the composable.This would be a breaking change and thus needs more discussion.
I can submit a PR for this if the idea sounds solid.
Suggested solution or improvement
This implementation of
useAsyncStoryblok
should work as described above.This could be then called like this (from playground folder):
Additional context
No response
Validations