Hi guys. having an issue with refetching a query a...
# orm-help
t
Hi guys. having an issue with refetching a query after a mutation. I have a code structure like this
Copy code
<Query query={A}>
  <Mutation mutation={B}>
  <Mutation>
<Query>
What I want is refetch A query after B mutation has executed. So, how can I do this with Query and Mutation components ?
j
If you give your query a name, e.g.:
Copy code
//     !
query Users {
  users {
    id
    name
  }
}
then you can pass that name to
refetchQueries[]
. E.g.:
Copy code
...
  <Mutation mutation={B} refetchQueries={['Users']}>
    // Fun stuff goes here
  </Mutation>
...
It's then run with the same arguments as you passed it last.
t
Thanks. But as for the documentation,
refetchQueries[]
won't wait for mutation to be completed. That's the issue I'm facing
Got it fixed 🙂 Used
awaitRefetchQueries={true}
j
Aaaah! GJ!