Replies: 2 comments 5 replies
-
Looks like what I need here is a referential equality for query key instead of 'hash' comparison but can't find whether react-query has such mode |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi 👋 I think composing the query key of the entity ID and type is sufficient 🙂 |
Beta Was this translation helpful? Give feedback.
5 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.
-
Hello 👋
Let's say I have some service like this:
where Provider is regular React's context provider.
The purpose of this service is to return data for provided entity (i.e. get
views
that belong to the entity)So later, down in the React tree, I want to make a request for views:
So the question is: how should I build a correct query key? Should it be like
useQuery(['views', viewService])
? From docs it's not very clear how react-query will serialize a service object which only contains methods.Or should I do something like this
useQuery(['views', viewService.entityId, viewService.entityType])
?Thank you in advance for any tips!
Beta Was this translation helpful? Give feedback.
All reactions