Invert query-mutation refetching #454
Unanswered
jackmellis
asked this question in
General
Replies: 2 comments
-
I'm working on this right now, actually. Moving this to a discussion for more ideas. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Did you have a particular pattern/implementation for this? Quite happy to help... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently there's a very tight coupling between mutations and queries:
your mutation must be aware of all queries that depend on it. In a large-scale application this can cause issues as your mutations have to be aware of seemingly unrelated queries. And if you have a mutation that's part of a 3rd party library, it's impossible to tie the queries to the mutation.
What I'm suggesting is to come up with a way for a query to specify which mutations should trigger it to refetch. This would really open up new ways to structure a react-query-based application.
I don't have an exact solution in mind, perhaps a subscribing system. I'd just like to start a discussion on the possible options. It's really the only stumbling block we have adopting react-query throughout our codebase
Beta Was this translation helpful? Give feedback.
All reactions