godon019
3/31/2019 - 6:42 AM

refetchQueries caveat

when I am using refetchQueries as below

mutationHandler<any, IPersonUpdateMutationVariable>({
  gqlName: PersonUpdateMutationGQL,
  mutate: mutate,
  refetchQueries: [PersonsGQL, PersonGQL],
  closeModal: props.closeModal
})

here PersonGQL has variable like below

export const PersonGQL = 'PersonGQL'
const PERSON_QUERY = gql`
query ${PersonGQL}($id: ID, $alias: String){
  person(
    id: $id
    alias: $alias
  ){
    id
    createdWhen
    name
    alias
    number
    address
    comment
    chugWonMun
  }
}
`

So, normally I have to pass variable to refetchQueries but it seems like I don't need to. and if I don't pass variables then it seems like it uses latest variable for that query.