apollo icon indicating copy to clipboard operation
apollo copied to clipboard

value is null

Open bovealexandre opened this issue 2 years ago • 7 comments
trafficstars

Environment



Describe the bug

I have this code

const result = await useAsyncQuery(usersQuery)

const Users = result.data.value?.users

and when i log result I have something in data value but when i log result data value it shows that it is null

Expected behaviour

just give me the result of my query

Reproduction

No response

Additional context

No response

Logs

No response

bovealexandre avatar Jul 23 '23 19:07 bovealexandre

does anyone else have this error?

bovealexandre avatar Sep 08 '23 07:09 bovealexandre

does anyone else have this error?

Yes I am, but when I disabled ssr in nuxt.config, the data loaded when the browser reloaded. I think this library does not support ssr yet.

ilhammeidi avatar Sep 09 '23 15:09 ilhammeidi

but I need SSR

bovealexandre avatar Sep 14 '23 18:09 bovealexandre

It loads on the server but when it hydrates it retries the request and then becomes null @Diizzayy ?

Edit: Doesnt work on initial load but works on hot reload

georgiai1 avatar Dec 19 '23 21:12 georgiai1

I ran into a similar issue where I had a <client-only> component that was calling useAsyncQuery in its script setup.

Oddly, adding an await nextTick() call fixed the issue.

gerbenvandijk avatar Apr 23 '24 15:04 gerbenvandijk

My queries work fine except for when I have logged in, closed tab and then and navigate directly to a page that has useAsyncQuery in setup. Seems Authentication isn't sent in this case and my backend returns a 401. Bearer token Is stored in Cookie in SSR, and is available when my function is called I can see.

jumptrnr avatar Apr 29 '24 21:04 jumptrnr

@jumptrnr, do you have proxyCookies set to false in the configuration?

If it is true. probably this PR will fix the issue https://github.com/nuxt-modules/apollo/pull/618

PS: This library does support SSR; we are using it without any problems with SSR enabled.

unrevised6419 avatar May 13 '24 17:05 unrevised6419