apollo
apollo copied to clipboard
can't use useQuery
just trying a super simple useQuery and it throws an error Uncaught (in promise) ReferenceError: getCurrentInstance is not defined
code:
<template>
<div class="h-full flex items-center justify-center">
<h1 class="text-8xl">username here</h1>
</div>
</template>
<script lang="ts">
import { watch } from "vue";
import { useQuery } from "@vue/apollo-composable";
import gql from "graphql-tag";
export default {
props: ["id"],
setup({ id }) {
id = parseInt(id);
const { result } = useQuery(
gql`
query getUsers {
user {
id
username
}
}
`
);
watch(result, value => {
console.log(value);
});
return { id };
}
};
</script>
<style></style>
To Reproduce Steps to reproduce the behavior:
- Use useQuery
- See the error
Expected behavior get the result of the query
Versions
vue: "vue": "^3.0.0"
vue-apollo: "@vue/apollo-composable": "^4.0.0-alpha.12",
apollo-client: "@apollo/client": "^3.3.6"
"snowpack": "^2.18.4",
"@snowpack/plugin-vue": "^2.2.6",
using snowpack btw:
"snowpack": "^2.18.4",
"@snowpack/plugin-vue": "^2.2.6",
@itaysmalia were you able to make this work?
@itaysmalia were you able to make this work?
Not yet.