Unexpected behavior from GraphQL queries after update from Sites 9.5 to Sites 9.6. Query (example below) no longer returns any data in the result. It does return nodes in the edges array but the nodes are empty. Issue occurs when using query fragments to select fields for the result. Query that no longer works that now returns empty nodes: { items(filter: {itemTypes: [COMPONENT], namespaceIds: [1], publicationIds: [12], customMeta: {key: "applicationPageTag", value: "Safe messages"} }) { edges { node { ...ApplicationPageTagFields } } } } fragment ApplicationPageTagFields on Component { __typename itemId schemaId title content(renderContent: true) { ... on UntypedContent { data } } } The response: { "data": { "items": { "edges": [ { "node": {} } ] } } }
Workaround 1: Remove query-fragment and fetch the component fields directly: { items(filter: {itemTypes: [COMPONENT], namespaceIds: [1], publicationIds: [12], customMeta: {key: "applicationPageTag", value: "Safe messages"}}) { edges { node { ... on Component { __typename itemId schemaId title content { ... on UntypedContent { data } } } } } } }
{ items(filter: {itemTypes: [COMPONENT], namespaceIds: [1], publicationIds: [12], customMeta: {key: "applicationPageTag", value: "Safe messages"}}) { edges { node { ...ApplicationPageTagFields } } } } fragment ApplicationPageTagFields on ApplicationConfiguration { __typename itemId schemaId title content { ... on UntypedContent { data } } } |
Issue resolved with hotfix CD_11.6.0_29001 We now handle graphql queries using the original syntax that uses Component. |
When using the items() query with components that have their type defined by the SCM you were unable to use a fragment spread across Component types since now these components have their own type defined by the schema. Meaning that the following query would not resolve: fragment Fields on Component { itemId schemaId title } { q1: items(filter: {itemTypes: [COMPONENT]}) { edges { node { itemId __typename ...Fields } } } }In the example above, consider a component using a NewsArticle schema. This component would not resolve with the Fields fragment because the type resolver would resolve the type to NewsArticle. The following change would need to be done: fragment Fields on NewsArticle { itemId schemaId title } { q1: items(filter: {itemTypes: [COMPONENT]}) { edges { node { itemId __typename ...Fields } } } } |