Allow injecting queryCache in hooks #1353
Unanswered
antonobergklarna
asked this question in
Ideas
Replies: 1 comment 7 replies
-
I think you can just get the queryCache with |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there!
We have a large app with 50 or so different teams working with and owning different features. Features contains both routes and in some cases components or services (data api) that is exposed and consumed by other features/teams. Its important for us that these features are isolated and can be loaded lazy. They also have different security requirements and we need to be able to flush state in individual features differently depending on auth levels etc. Features also need to be able to act on events from fetching life-cycles that are initiated from the specific feature.
We are evaluating react-query and in general it seams like a good fit however we would like to be able to have multiple query caches and inject them into the hooks. We can achieve a similar result by wrapping all hooks and prefixing query-keys with namespaces for features and security-zones and use the prefixes to route events to the correct feature but it would be easier if each feature can have its own cache.
Note that since we in some cases export methods and hooks that is consumed by other features / other routes we cant use the Provider as a way to use different caches.
Would it be possible to add a queryCache as an optional param to the hooks?
This might be related to this discussion;:
#1220
Beta Was this translation helpful? Give feedback.
All reactions