# Subquery element null when using a fragment

**URL:** <https://community.apollographql.com/t/subquery-element-null-when-using-a-fragment/6499>\
**Category:** Client SDKs\
**Tags:** client\
**Created:** [July 18, 2023, 6:33pm UTC](https://community.apollographql.com/t/subquery-element-null-when-using-a-fragment/6499 "2023-07-18T18:33:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![natethelen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/natethelen/32/4446_2.png) [@natethelen](https://community.apollographql.com/u/natethelen)\
**Post date:** [July 18, 2023, 6:33pm UTC](https://community.apollographql.com/t/subquery-element-null-when-using-a-fragment/6499/1 "2023-07-18T18:33:11Z")

</div>

We have a query like this that works as expected:

```auto
query GetItems($getItemsInput: GetItemsInput!) {
  getItems(getItemsInput: $getItemsInput) {
    uuid
    user {
      firstName
      lastName
    }
  }
}

```

But when I use a fragment with the same inputs, the “user” comes back null (uuid is there both ways)

```auto
query GetItems($getItemsInput: GetItemsInput!) {
  getItems(getItemsInput: $getItemsInput) {
    ...ItemsRow
  }
}

fragment ItemsRow on Item {
  uuid
  user {
    firstName
    lastName
  }  
}

```

Any ideas on why and/or where we should look to figure this out? This is using the Playground as the client.

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [July 19, 2023, 9:46am UTC](https://community.apollographql.com/t/subquery-element-null-when-using-a-fragment/6499/2 "2023-07-19T09:46:41Z")

</div>

Is `Item` here the actual type or an interface? In the case of an interface, the playground might not be aware of a parent-child relationship between the `Item` interface and the actual type.

---

<div class="post-metadata">

**Author:** ![natethelen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/natethelen/32/4446_2.png) [@natethelen](https://community.apollographql.com/u/natethelen)\
**Post date:** [July 19, 2023, 5:50pm UTC](https://community.apollographql.com/t/subquery-element-null-when-using-a-fragment/6499/3 "2023-07-19T17:50:15Z")

</div>

It is a type. And it also happens when using the React Apollo client

---

<div class="post-metadata">

**Author:** ![natethelen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/natethelen/32/4446_2.png) [@natethelen](https://community.apollographql.com/u/natethelen)\
**Post date:** [July 22, 2023, 6:07pm UTC](https://community.apollographql.com/t/subquery-element-null-when-using-a-fragment/6499/4 "2023-07-22T18:07:03Z")

</div>

Turns out it was the result of an optimization we were doing on the backend. Worked it out.

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:48pm UTC](https://community.apollographql.com/t/subquery-element-null-when-using-a-fragment/6499/5 "2025-02-06T20:48:33Z")

</div>


