nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
956 stars 198 forks source link

No data after fetching #478

Closed kuraiconnect closed 1 year ago

kuraiconnect commented 1 year ago

Environment

Describe the bug

i have a problem with data fetching.

click login for get access token

pick apollo or fetch for fetching data

when i try to fetch data with useQuery. After that i fetch data in network -> preview

Screenshot 2023-02-07 at 19 25 57

but useQuery do not show this data:

Screenshot 2023-02-07 at 19 25 01

i try fetch data with $fetch and it's work

Screenshot 2023-02-07 at 19 25 06

but it is not best.

how i can fix it?

Expected behaviour

i would like to get the correct data with useQuery

Reproduction

https://codesandbox.io/p/sandbox/beautiful-artem-u0uohu?selection=%5B%7B%22endColumn%22%3A40%2C%22endLineNumber%22%3A13%2C%22startColumn%22%3A40%2C%22startLineNumber%22%3A13%7D%5D&file=%2Fpages%2Findex.vue

Additional context

No response

Logs

No response

Baroshem commented 1 year ago

I am experiencing the same problem :(

kuraiconnect commented 1 year ago

I am experiencing the same problem :(

You can try use fetch like me. Not cool but work 😅

I think that problem with that result is a ref. And vue can not read so deep object like this

yepsconnect commented 1 year ago

@Baroshem I think that I found a solution

before solution: Screenshot 2023-03-29 at 13 14 59

first i change apollo congifuration in nuxt.config.ts file. i removed inMemoryCacheOptions for problem endpont

Screenshot 2023-03-29 at 12 08 20

after that i changed options for useQuery Screenshot 2023-03-29 at 12 48 51

result: Screenshot 2023-03-29 at 13 14 35

i think this problem only appears if the request has fragments in the body. if you disabled addTypename: false in apollo configuration, request will answer without typename and request body wich belongs that typename

i am not sure that it help for you, @Baroshem , but it is good for me.