Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

65
Visualizações
Get parent object at field type policy

Let's say that I have the following query that fetches a list of products.

query ProductList() {
  products() {
    name
    price
    stockQuantity
    isAvailable @client # This is a local-only field
  }
}

Also I have added a type policy for a local-only field at the in-memory cache creation, with a read function:

const cache = new InMemoryCache({
  typePolicies: { // Type policy map
    Product: {
      fields: { // Field policy map for the Product type
        isAvailable: { // Field policy for the isAvailable field
          read(existing, context) { // The read function for the isAvailable field
            // Return value
          }
        }
      }
    }
  }
});

How can I get the stockQuantity field of the parent Product object at the isAvailable read function?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

const cache = new InMemoryCache({
  typePolicies: { // Type policy map
    Product: {
      fields: { // Field policy map for the Product type
        isAvailable: { // Field policy for the isAvailable field
          read(existing, {readField}) { // The read function for the isAvailable field
            const stockQuantity = readField("stockQuantity");
            return stockQuantity ? true : false;
          }
        }
      }
    }
  }
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda