setQueryData invalidate
option
#1766
Answered
by
tannerlinsley
lekterable
asked this question in
Ideas
Replies: 2 comments 2 replies
-
I would instead urge users to create this abstraction utility on their own. This will keep the size of the core library down
Tanner Linsley
…On Feb 8, 2021, 4:28 PM -0700, Kornel Dubieniecki ***@***.***>, wrote:
I can see that
queryCache.setQueryData
is very often used together with
queryCache.invalidateQueries
for example:
queryCache.setQueryData('posts, [newPost]')
queryCache.invalidateQueries('posts')
what if we allowed setQueryData to take the third argument options and in particular, the option invalidate
if we had that we could simply do:
queryCache.setQueryData('posts, [newPost]', { invalidate: true })
which saves us a line of code on every occasion and provides a very useful abstraction
I'm totally down for working on a PR for that if you like it 🤙
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lekterable
-
Invalidate will usually be done with fuzzy matching, while setQueryData is exact. If i have a list of tasks that i can filter, and i add a new task to the current view, I’ll call |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
I can see that
queryCache.setQueryData
is very often used together with
queryCache.invalidateQueries
for example:
what if we allowed
setQueryData
to take the third argumentoptions
and in particular, the optioninvalidate
if we had that we could simply do:
queryCache.setQueryData('posts, [newPost]', { invalidate: true })
which saves us a line of code on every occasion and provides a very useful abstraction
I'm totally down for working on a PR for that if you like it 🤙
Beta Was this translation helpful? Give feedback.
All reactions