React-query: queryCache is empty when using ReactQueryCacheProvider

Created on 1 Sep 2020  路  2Comments  路  Source: tannerlinsley/react-query

Describe the bug
When I'm trying to queryCache.invalidateQueries(keyGoesHere) and I'm using the new hydration API, the queryCache object is empty, so I cannot invalidate or override any of the data.

Expected behavior
queryCache should contain the queries that are prefetched on the "Hydrate" component or another way to invalidate or set new data for a specific query.

Screenshots
Screenshot 2020-09-01 at 11 52 43

Screenshot 2020-09-01 at 11 52 11

Screenshot 2020-09-01 at 11 51 51

*Desktop *
-macOs

Most helpful comment

For someone else having the same issue

instead of import { queryCache } from "react-query" you should use const querycache = useQueryCache()

All 2 comments

For someone else having the same issue

instead of import { queryCache } from "react-query" you should use const querycache = useQueryCache()

I had this issue as well where the 'import' technique was not clearing the cache setup by ReactQueryCacheProvider. Using the hook resolved the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

the133448 picture the133448  路  4Comments

alveshelio picture alveshelio  路  6Comments

lgenzelis picture lgenzelis  路  4Comments

tiagoengel picture tiagoengel  路  5Comments

ggascoigne picture ggascoigne  路  4Comments