godon019
4/23/2019 - 7:11 AM

RefetchQueries log

Refetch after mutation

Currently I found a solution that is working well( not tested with variables )
Below is past log


solution 1

So nothing is working but 'refetchQueries' with certain forms like below

refetchQueries: () => ['ReportablesBy']
...
export const REPORTABLES_QUERY = gql`
query ReportablesBy($id: ID, $alias: String){
  reportables(
    pogyowonInfo: {
      id: $id
      alias: $alias
    }
  ){  
    id
    }
}

see how I should use ReportablesBy not REPORTABLES_QUERY with this, I can skip setting variables somehow...

→ this seems like it uses variables used in the past again. it is prone to make error sometime in the future. using second solution could be better

solution2

I didn't try yet but another way to solve it would be using graphQL HOC with refetch btw https://github.com/apollographql/apollo-client/issues/3633#issuecomment-440962745 and HOC docs

Didn't work

other means such as 'update' or

refetchQueries :[{
          query: REPORTABLES_QUERY,
          variables: ({alias: "testPogyowon"})
        }]

doesn't work at all

.... because of this kind of error I lost 3 hours almost!