menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

gatsby-drupal-wg

Gatsby Working Group: Drupal - Drupal module: https://www.drupal.org/project/gatsby - Gatsby source plugin: https://www.gatsbyjs.org/packages/gatsby-source-drupal/

Channels
Team

I currently have 2 separate issues I am trying to find solutions for.

July 15, 2019 at 2:54pm

I currently have 2 separate issues I am trying to find solutions for.

July 15, 2019 at 2:54pm
First, is nested menu items? I'm not finding any child parent relationships to work from.
Second, optional fields. Specifically, optional block/node reference fields. What are you guys putting in your gatsby-node.js so that nodes that don't have a node/block reference don't break?

July 15, 2019 at 3:55pm
For optional fields you need to look into inline fragments. https://graphql.org/learn/queries/#inline-fragments
The issue with optional fields is building the automated schema, if it sees a type/field on one node that doesnt exist in another, it creates a union type, which has to be queried this way.
that looks like it just might get me somewhere. Thanks.

September 12, 2019 at 7:24am
The most interesting development I have seen about this issue is this: https://github.com/gatsbyjs/gatsby/pull/16291
(otherwise so far in our project we have basically created a "example content" for each content type, then excluded it from the queries in gatsby-node.js , but it's clearly not ideal.