Subscribe to specific parts of the cache and update ui when cache is updated via optimistic update #6343
Unanswered
AndonMitev
asked this question in
General
Replies: 0 comments
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.
-
Hey I do have following scenario, I have created a query function that is fetching initial state and stores it. Later i receive new state and i update the cache manually. In my components i'm using the query to read the data but i'm not retrieving latest data. I check there is a
queryClient.getQueryCache().subscribe()
but does subscribe to the whole cache and not to specificqueryKey
? So how i can subscribe to the cache so when is updated manually on new message to consume it where is needed?queryFn:
Updating cache manually when new socket message is received:
Currently the way that i'm reading data:
const { data } = useGetFriendsList();
Beta Was this translation helpful? Give feedback.
All reactions