[AFTER PATCH] Did you forget to call `useClient`?
See original GitHub issueVersions with Issue : Rc0 + Rc1
Issue happens when getReport() is called on change of a date. When getReport() is called during page load /setup it works fine.
Logic of program is when date input is changed, send useQuery to fetch data using the selected date.
App.VUE
<script lang="ts">
import { SubscriptionClient } from "subscriptions-transport-ws";
import { defineComponent, computed } from "vue";
import DesktopMenu from "./components/DesktopMenu.vue";
import { router } from "./main";
import { useClient } from "villus";
import { ActionTypes, MutationTypes, useStore } from "./store";
export default defineComponent({
name: "Navigation",
components: {
DesktopMenu,
},
setup() {
const store = useStore();
useClient({
url: "/graphql",
});
},
});
</script>
Home.VUE
<template>
<div>
Home
<input v-model="datePage" type="date" />
<p v-if="returnData">
{{ returnData }}
</p>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, computed, watchEffect } from "vue";
import { useQuery } from "villus";
import { CostDocument } from "../generated/graphql-operations";
export default defineComponent({
name: "HelloWorld",
setup() {
const returnData = ref();
const datePage = ref("2020-10-18");
const formattedDate = computed(() =>
datePage.value.toString().split("-").join(""),
);
const data = ref(null);
watchEffect(async (datePage) => {
async function getReport() {
try {
console.log("date value changed:", formattedDate);
const { data, error } = await useQuery({
query: CostDocument,
variables: { date: formattedDate.value },
});
console.log("Query:", data, error);
returnData.value = data;
} catch (error) {
console.log("error", error);
}
}
data.value = await getReport();
});
return { returnData, datePage };
},
});
</script>
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Cannot detect villus Client, did you forget to call useClient ? #72
When i use UseQuery in a child component, i don't have any error. We cannot use useClient and useQuery in the same level...
Read more >Designing GraphQL Mutations
If you start with a general “catch-all” mutation, adding extra inputs is much more difficult. Don't be afraid of super specific mutations that ......
Read more >What could happen if I don't close response.Body?
The connection won't be re-used, and can remain open in which case the file descriptor won't be freed. Also is it safe to...
Read more >560361 – Dhclient doesn't use client-identifier - Red Hat Bugzilla
No, I don't have any hardware infiniband entries. Last I knew, they weren't supported on rhel7 dhcpd and just fail. No, what you...
Read more >What's New in Next.js 13 - AppSignal Blog
You can use Client Components by specifying a "use client" directive at the ... In other cases, when you don't need things from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed with reactive. No more help needed.
Thanks again or all your hard work on Villus!
Couldn’t you disable
fetchOnMount
and justexecute
whenever you need to?