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

Queries return undefined when entities have expired #70

Open
Amnesthesia opened this issue Aug 24, 2023 · 3 comments
Open

Queries return undefined when entities have expired #70

Amnesthesia opened this issue Aug 24, 2023 · 3 comments

Comments

@Amnesthesia
Copy link

When we use the timeToLive setting, entities seem to be expiring in the cache — but, after expiring, even though the query is correctly firing a network call again the next time it is requested (although, would have preferred it to automatically fire again as soon as the cache expires), the data object received is undefined

This is super strange, because I can see the request being fired and a response being returned, but nothing is received by Apollo — it's as if the new response isn't being written to the cache? Perhaps that query is stuck with an old cache key?

@danReynolds
Copy link
Collaborator

Thanks for the report! So a query expires via TTL, it goes to network to get the data again, but it never returns that data? Is there a repro I could look into?

@Amnesthesia
Copy link
Author

@danReynolds Yeah that's exactly what's happening — I see the network request, and const { data } = useQuery(..) is undefined, even though the request just came through. Disabling TTL again fixes it

Unfortunately our repo is private but I tried to reproduce the behaviour here, and can get similar behaviour:

https://codesandbox.io/s/suspicious-goldstine-rw2ggr?file=/src/graphql/query.tsx

Screenshot 2023-08-28 at 08 20 24

@Amnesthesia
Copy link
Author

@danReynolds any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants