Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
¿Cómo obtener el fragmento de graphQl?

Necesito configurar fragment en mi gql. Es código de trabajo:

 const findEntity = gql` query findEntity($pagination: Pagination, $sort: Sort) { organizationList(pagination: $pagination, sort: $sort) { data { _id name } } } `;

Este código no funciona:

 const TEST_FRAGMENT = gql` fragment organizationList on OrganizationsPage { data { _id name } } `; const findEntity = gql` query findEntity($pagination: Pagination, $sort: Sort) { organizationList(pagination: $pagination, sort: $sort) { ${TEST_FRAGMENT} } } `;

errores: [{mensaje: "No se puede consultar el campo "fragmento" en el tipo "OrganizationsPage".",…},…]

¿Qué hice mal? Creo que repetí la muestra de documentación...

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Los fragmentos usan una sintaxis de pseudo-spread y debe incluirlos en la consulta. También usé mayúsculas para el nombre del fragmento para el cumplimiento de la convención.

 const findEntity = gql` ${TEST_FRAGMENT} query findEntity($pagination: Pagination, $sort: Sort) { organizationList(pagination: $pagination, sort: $sort) { ...OrganizationListFields } } `;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!