moltin / gatsby-source-moltin

🚀 Gatsby source plugin for building Elastic Path Commerce Cloud powered eCommerce websites
https://www.gatsbyjs.org/packages/@moltin/gatsby-source-moltin
MIT License
21 stars 4 forks source link

Issue destructuring included object if there are no main_image relationships #15

Closed ynnoj closed 5 years ago

ynnoj commented 5 years ago

When destructuring the the included object from the call to get all products we need to defend against cases where none of the retrieved products have a main_image relationship. In those instances we're unable to destrcuture from an undefined object (included).

TypeError: Cannot destructure propertymain_imagesof 'undefined' or 'null'.

https://github.com/moltin/gatsby-source-moltin/blob/4b34775e6a59b4a513c1eb7c5100c412780acb4c/gatsby-node.js#L125-L128

ynnoj commented 5 years ago

:tada: This issue has been resolved in version 1.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: