I’m trying to get a level 3 nested property (username
) in my query, but it keeps coming back undefined. Is this a bug or am I messing up somewhere?
export const QUERY = gql`
query FindDemosBySpaceId($id: String!) {
space(id: $id) {
demos {
id
spaceId
userId
user {
username <-- undefined
}
title
url
createdAt
}
}
}
`
I can get the username if i make a level 2 nested query
export const QUERY = gql`
query FindDemoById($id: String!) {
demo: demo(id: $id) {
id
spaceId
userId
user {
username <-- Yes! has a value
}
title
url
createdAt
}
}
`
These are the relative SDLs. Note that PublicUser
should be available on a Demo
returned in a Space
type Space {
id: String!
user: PublicUser!
userId: String!
title: String!
accepting: Boolean!
demos: [Demo]!
createdAt: DateTime!
}
type Query {
spaces: [Space!]! @requireAuth
space(id: String!): Space @requireAuth
}
type Demo {
id: String!
spaceId: String!
user: PublicUser!
userId: String!
title: String!
url: String!
createdAt: DateTime!
}
type Query {
demos: [Demo!]! @requireAuth
demo(id: String!): Demo @requireAuth
}
type PublicUser {
id: String!
username: String!
}