graphql-zeus icon indicating copy to clipboard operation
graphql-zeus copied to clipboard

best way to use refetchQueries

Open drasch opened this issue 4 years ago • 0 comments

Here's how I've gotten this to work with React, but I'm hoping there's a better way other than the [gql(Zeus.query(q_get_profile))] call below:

const { loading, error, data } = useTypedQuery(q_get_profile)        
                                                                     
const [mutation] = useTypedMutation(                                 
  {                                                                  
    update_profiles_by_pk: [                                         
      {                                                              
        pk_columns: { id: $`profileId` },                            
        _set: $`_set`,                                               
      },                                                             
      {                                                              
        id: true                                                     
      }                                                              
    ]                                                                
  },                                                                 
  {                                                                  
    refetchQueries: [gql(Zeus.query(q_get_profile))],                
  }                                                                  
)                                                                    

Thanks! David

drasch avatar Nov 16 '21 16:11 drasch