Delete mutation doesn't update UI

The data is refetched (I see graphql request in devtools networks with the updated data) but the UI is not updated

  const [deleteOrder] = useMutation(DELETE_ORDER_MUTATION, {
    onCompleted: () => {
      toast.success('Order deleted')
    },
    onError: (error) => {
      toast.error(error.message)
    },
    refetchQueries: [{ query: QUERY }], // QUERY from Cell component
    awaitRefetchQueries: true,
  })

Other mutations (at least update mutation) do work.

upd passing query name "FindOrders" instead of query object { query: QUERY } does update the UI :thinking:

Hi. We already chatted re this question in Discord.

I suggest passing the variables in the refetchQueries per:

and seeing if that helps.

what variables do I pass?

upd thank you @dthyresson, I understand the issue now. Passing variables does indeed solve the problem.

1 Like

Great! Good to know.