question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export VILLUS_CLIENT symbol

See original GitHub issue

It could be useful to export the VILLUS_CLIENT symbol in order to access the provided client from other composable functions.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
logaretmcommented, Nov 18, 2020

I usually either pass it via props if it’s just 1 level deep or use provide/inject there, so I actually have something like this as well:

const product = computed(() => {
  return data.value?.products?.items[0];
});

provide('PRODUCT_CTX', product); // I use a symbol here, but strings work fine

// later on in a deeply nested child
const product = inject('PRODUCT_CTX');

product.value; // access query value
1reaction
logaretmcommented, Nov 18, 2020

Yes it would create several clients. But I’m not sure you need to do that, I do use nuxt/composition-api in a production app with tons of GraphQL queries but didn’t seem to encounter your use-case.

I do have a lot of data transforms, but I use computed for that. For example:

function useProduct(id) {
  const { data, isFetching } = useQuery({
    query: ProductQuery,
    variables: { id }
  });

  // this query returns multiple product matches
  // i just need the first match
  const product = computed(() => {
    return data.value?.products?.items[0];
  });

  return {
    product,
    isFetching
  };
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot detect villus Client, did you forget to call useClient ? #72
Hello, i get this error Cannot detect villus Client, did you forget ... ({ url: "https://pet-library.moonhighway.com/", }) export const { data } ...
Read more >
How can I save an export list of symbols in my object file ... - IBM
1. This PTF has the new -qkeepinlines=exports option that can be used to avoid this problem. Specify the symbols to export as follows:...
Read more >
nuxt-villus - npm Package Health Analysis - Snyk
Provide Villus client to Nuxt / Vue ... export default { modules: ["nuxt-villus"], villus: { /** * GraphQL HTTP endpoint */ httpEndpoint: ...
Read more >
exporting symbols from executable - Google Groups
Hello, Does anyone know of drawbacks (performance penalties) to exporting symbols from executables? The way I did that (on linux) was passing
Read more >
Export graphics and videos with Animate CC - Adobe Support
You can export a series of image files from an individual movie clip, button, or graphic symbol in the Library or on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found