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

Cannot detect villus Client, did you forget to call useClient? #72

Closed
stephanedemotte opened this issue Oct 24, 2020 · 2 comments
Closed

Comments

@stephanedemotte
Copy link

stephanedemotte commented Oct 24, 2020

Hello, i get this error Cannot detect villus Client, did you forget to call useClient?

reproduction

<script setup>
import { useClient, useQuery } from 'villus'

useClient({
  url: "https://pet-library.moonhighway.com/",
})

export const { data } = useQuery({ query: `
  query AllPets ($category: PetCategory) {
    allPets (category: $category) { id }
  }
` })
</script>

When i use UseQuery in a child component, i don't have any error.

We cannot use useClient and useQuery in the same level anymore ?

The error come with the latest release.

Thanks !!

@logaretm
Copy link
Owner

logaretm commented Oct 24, 2020

Not a villus issue, this is a change that was introduced in Vue 3.0.2 vuejs/core#2424

I don't like that change personally but it's not a big issue as you can always wrap your components in a root one.

@logaretm
Copy link
Owner

logaretm commented Oct 26, 2020

Quick update: I have implemented a workaround similar to what I have in vee-validate at the moment that bypasses vuejs/core#2424, since villus isn't meant to be used with the options API anyways that makes it fine to have such a workaround.

I think this offers better usability especially for workflows without deep component trees. This patch will be up with the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants