Track data changes
Hi All,
What is the bast way to subscribe to updates of my cache in such a way that I only get notified if the data has changed? Doing this from a different place in my app than where I use the useQuery hook.
Also, how can I validate structuralSharing is working properly? Is there any quick debug I can use to check this?
4 Replies
other-emerald•15mo ago
Structural sharing: refetch and see if it triggers a rerender if data stays the same
Just use the useQuery hook in your different place again?
conscious-sapphireOP•15mo ago
Is there a way to do it without using the useQuery hook?
other-emerald•15mo ago
Why would you want that??
conscious-sapphireOP•15mo ago
I want to keep track of data changes without defining the queryFn or any other options.
I am now using a wrapper hook that just defines the queryFn and options for me and I can use that to subscribe to updates of data. However I am using experimental_createPersister and at the start of the app data is "updated" but was not changed. I dont want to run my code in this case.