Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache redirect via type policy causes useQuery to return undefined on the first render, despite having data in the cache #9275

Closed
dan-cooke opened this issue Jan 6, 2022 · 2 comments

Comments

@dan-cooke
Copy link
Contributor

dan-cooke commented Jan 6, 2022

Previous closed issues that are related
#6686
and
#6659

However this timeloading is false on the first render, data is undefined.

See the following screenshot,
image

If i expand out the cache.data.data.[MyType:ID] I can see that the fully cached object is available on the first render.

However via useQuery i am getting undefined

Version
@apollo/client 3.5.6

@dan-cooke dan-cooke changed the title [regression] useQuery returns undefined on first render with data in cache [regression] useQuery returns undefined data on first render with data in cache Jan 6, 2022
@dan-cooke
Copy link
Contributor Author

Okay I just checked and this issue is still happening for me even in 3.1.0 (the version where it was reportedly fixed)

So it may be a "me" issue.

Still investigating

@dan-cooke dan-cooke changed the title [regression] useQuery returns undefined data on first render with data in cache Cache redirect via type policy causes useQuery to return undefined on the first render, despite having data in the cache Jan 6, 2022
@dan-cooke
Copy link
Contributor Author

Closing issue.

It was definetly a "me" issue.

I was using a lazy query, and depending on a useEffect in order to trigger it.. so on the first render it was not firing..

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant