-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
The default case with queryCache.setQueryData
is "If the query does not exist, it will be created and immediately be marked as stale"
-
What if you want to check if query exists or not
-
In case of using
queryCache.setQueryData
, What to do if you don't want to create query if it does not exist
I did that to resolve 2nd issue:
const oldTimeline = queryCache.getQueryData('timeline');
if (oldTimeline) {
queryCache.setQueryData('timeline', (groups) => {
groups.forEach((group, i) => {
groups[i] = group.filter((post) => post._id !== photoId);
});
return groups;
});
}
As you can see, the above solution is quite cumbersome.
What if there's a method called queryCache.hasQueryData
which I can use so I don't have to use
queryCache.getQueryData
?
Metadata
Metadata
Assignees
Labels
No labels