apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Graphql fragments which contain child elements do not return any subset data

Open toddpadwick opened this issue 4 years ago • 1 comments

Description

Here is an example fragment for a field that contains child elements:

    fragment landingPageBuilderFrag on landingPageBuilder_MatrixField {
      ... on landingPageBuilder_sectionHeadline_BlockType {
        typeHandle
        sectionTitle
        headline
        introduction
      }
      ... on landingPageBuilder_logoParade_BlockType {
        typeHandle
        organisations {
          url
          title
          slug
          id
          uri
          ... on organisations_organisation_Entry {
            logo {
              extension
              width
              height
              url
              id
              title
              srcset(sizes: ["100", "300", "400"])
            }
          }
        }
      }
      ... on landingPageBuilder_faqs_BlockType {
        typeHandle
        faqs {
			    ... on faqs_BlockType {
            question
            answer
          }
        }
        callToAction {
          ... on callToAction_BlockType {
        	    ... callToActionSuperTableFrag     
          }
        }
      }
    }

I would like to then use this fragment for multiple entry types which contain this field, for example:

    ... on homepage_homepage_Entry {
          landingPageBuilder {
              ...landingPageBuilderFrag
          }
        }

In the GraphiQL explorer and in Postman, this works fine as expected. But when queried via our Nuxt Apollo app it returns an array for each child element but without its subset contents. here is a screenshot of the response in the console:

Screenshot 2021-09-02 at 17 08 23

as you can see non of the subset data is returned for any of the sub-blocks.

Additional info

  • @nuxtjs/apollo: ^4.0.1-rc.5,
  • nuxt: ^2.15.4,

toddpadwick avatar Sep 02 '21 17:09 toddpadwick

Had the same issue on the current alpha8 release.

@toddpadwick did you resolve the problem?

frieddbm avatar Nov 10 '23 19:11 frieddbm