Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to avoid graphql error when yaml's array element is empty #9831

Closed
github0013 opened this issue Nov 9, 2018 · 1 comment
Closed
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@github0013
Copy link
Contributor

github0013 commented Nov 9, 2018

Summary

I understand yaml files need proper contents according to graphql queries in codes, but in my case, yaml contents are dynamic. They are sometimes no data (I update yaml files before a build).

If an array in yaml is empty, graphql queries using the yaml will fire an error. This error is critical, and it stops the process when to build.
** I need to show the page with the empty data. (I can't skip the page)

This is how I avoid the build error.
https://github.com/github0013/empty_yaml_load

Here are my questions

  1. Is there a way to avoid this graphql error when you have such an empty array?
  2. Can we implement yaml data type definition in gatsby? so that we can simply have an empty array data without being worried about filtering out the dummy type definition data (see https://github.com/github0013/empty_yaml_load) ?

Relevant information

Environment (if relevant)

─➤ gatsby info --clipboard

System:
OS: macOS Sierra 10.12.6
CPU: x64 Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
Shell: 5.2 - /bin/zsh
Binaries:
Node: 10.9.0 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.2.0 - /usr/local/bin/npm
Browsers:
Chrome: 70.0.3538.77
Firefox: 63.0.1
Safari: 12.0.1
npmPackages:
gatsby: ^2.0.35 => 2.0.35
gatsby-plugin-manifest: ^2.0.7 => 2.0.7
gatsby-plugin-no-sourcemaps: ^2.0.1 => 2.0.1
gatsby-plugin-offline: ^2.0.12 => 2.0.12
gatsby-plugin-react-helmet: ^3.0.1 => 3.0.1
gatsby-plugin-sass: ^2.0.3 => 2.0.3
gatsby-plugin-typescript: ^2.0.1 => 2.0.1
gatsby-plugin-typography: ^2.2.1 => 2.2.1
gatsby-source-filesystem: ^2.0.7 => 2.0.7
gatsby-transformer-yaml: ^2.1.4 => 2.1.4
npmGlobalPackages:
gatsby-cli: 2.4.2

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

@kakadiadarpan kakadiadarpan added the type: question or discussion Issue discussing or asking a question about Gatsby label Nov 9, 2018
@LekoArts
Copy link
Contributor

As you can see in the issue #2392 (comment) (and the linked issue) that's currently the only way to circumvent this error.

Closing this as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants