QueryObserver with partial key
Is there a way to subscribe to multiple queries with a partial query key? Say, for example, I have the query keys ['person'] as a meta-key, and then the individual people are stored in the cache with the keys ['person', 'some-id'], ['person, 'other-id']. I want to observer the cache, and get notified any time a person key changes. Is there a way to do that with a QueryObserver or something similar?
4 Replies
afraid-scarlet•2y ago
no, you can only do queryCache.subscribe(), but that will get all events for all queries, so you'd need to filter down. This is what
useIsFetching() doesflat-fuchsiaOP•2y ago
Gotcha, thanks
I see
partialMatchKey isn't exported... Is there any way I can check if the key for the cache update matches my partial key, or will I have to reimplement that?afraid-scarlet•2y ago
matchKey is exported
aah, matchQuery is exported
that's the one you wantflat-fuchsiaOP•2y ago
Ah, gotcha. Thanks!