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

useStoryblok and useAsyncStoryblok doesnt support being used outside of setup because bridge needs onMounted #257

Closed
SebbeJohansson opened this issue Dec 20, 2022 · 2 comments
Assignees
Labels
invalid [Issue][PR] This doesn't seem right

Comments

@SebbeJohansson
Copy link
Contributor

Since both useStoryblok and useAsyncStoryblok require it being used in setup, it is not possible to get proper routing when using app.vue instead of pages

The point behind me wanting to use my own routing instead of vue-router (which is what the pages folder in nuxt uses) is to save on bundle size. The way I need to do the route check might be a bit special since I need to support fetching from multiple CMS' in my application.

Expected Behavior

I would expect useStoryblok and useAsyncStoryblok to work properly in for example watchEffect so that I can watch on route changes.

Current Behavior

I get warnings about onMounted being used outside of setup, which I think is coming from the bridge.
image

Steps to Reproduce

  1. Create a new Nuxt3 project from scratch.
  2. Add fetching from storyblok using useStoryblok or useAsyncStoryblok inside a watchEffect.

image
image
image

Full disclosure, this could all just be from me trying to do weird stuff

@SebbeJohansson SebbeJohansson changed the title useStoryblok and useAsyncStoryblok doesnt support being used in app.vue since it only works properly in setup. useStoryblok and useAsyncStoryblok doesnt support being used outside of setup because bridge needs onMounted Jan 11, 2023
@Dawntraoz Dawntraoz added the invalid [Issue][PR] This doesn't seem right label Jun 19, 2023
@Dawntraoz Dawntraoz self-assigned this Jun 19, 2023
@Dawntraoz
Copy link
Contributor

Hi @SebbeJohansson, you can always use useStoryblokApi and the useStoryblokBridge composables separated in this case.

For now, I will close this one, and we will work on making the module work on the server side by allowing this feature -> #440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid [Issue][PR] This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants