1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Apollo Client is refetching a query after an add mutation but not a delete

Discussão em 'Angular' iniciado por William Neely, Setembro 29, 2024.

  1. I have a mutation that adds a todo to a list of todos.

    mutation AddTodo($data: AddTodoInput!) {
    addTodoToList(data: $data) {
    id
    todos{
    id
    }
    }
    }


    I have another mutation that deletes a todo:

    mutation DeleteTodo($data: DeleteTodoInput!) {
    deleteTodoFromList(data: $data) {
    id
    todos{
    id
    }
    }
    }


    This is the query for the list:

    query List{
    id,
    todos {
    id
    name
    }

    }


    The delete properly deletes the todo and removes it from the list without refetching the list. But when I add an item, it causes a refetch. Since I'm returning the todos list, that's unexpected. What's the issue?

    Continue reading...

Compartilhe esta Página