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

Allow class instances to be passed onto Gatsby #9117

Closed
JanLenoch opened this issue Oct 15, 2018 · 7 comments
Closed

Allow class instances to be passed onto Gatsby #9117

JanLenoch opened this issue Oct 15, 2018 · 7 comments
Labels
help wanted Issue with a clear description that the community can help with. stale? Issue that may be closed soon due to the original author not responding any more.

Comments

@JanLenoch
Copy link

Summary

Currently, only plain JavaScript objects can be passed onto Gatsby's createNode API method. When a class instance is passed, Gatsby build will fail with an "Unknown field … on type …" GraphQL error (#8053).

Motivation

Our headless CMS has a solid JS SDK that works with class instances by default. We'd like to utilize it to its full potential in Gatsby. We can't ATM.

@pieh
Copy link
Contributor

pieh commented Oct 15, 2018

Some context for this - this check

} else if (_.isPlainObject(exampleValue)) {
would need to be changed to be smart enough to allow class instances, but blacklist at least some of them (like Date, Number, Array, Map, Set, WeakMap, WeakSet, Promise, ArrayBuffer)

@JanLenoch
Copy link
Author

Hi @pieh , just to get an idea: Is this issue somewhere higher in the priority list (if any)? We're currently thinking of doing other plugin development and if the class instance support is on the horizon of say weeks then we'd wait for you to implement it. It would be better than writing code that we'd probably throw away after the class instance support comes. Thanks!

@pieh
Copy link
Contributor

pieh commented Oct 30, 2018

Right now I can't invest any time into doing any development on this, but I'd like to encourage You (or anyone else) to try to implement support for that and open PR (even if it's work-in-progress).

@pieh pieh added the help wanted Issue with a clear description that the community can help with. label Nov 27, 2018
@gatsbot
Copy link

gatsbot bot commented Feb 3, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 3, 2019
@arobida
Copy link

arobida commented Feb 12, 2019

Hi @pieh , just to get an idea: Is this issue somewhere higher in the priority list (if any)? We're currently thinking of doing other plugin development and if the class instance support is on the horizon of say weeks then we'd wait for you to implement it. It would be better than writing code that we'd probably throw away after the class instance support comes. Thanks!

Out of pure curiosity do you want to use classes for the purpose of using state? @JanLenoch

@JanLenoch
Copy link
Author

Hi @arobida , I'm not sure what you mean by saying "for the purpose of using state". Anyways, we'd like to use classes as our HCMS already has a robust JavaScript SDK that provides content as class instances. Simply put, our source plugin does not talk directly to our Delivery/Preview API endpoints. It uses the SDK to do that and consumes the data as class instances.
Did that answer your question?

@gatsbot
Copy link

gatsbot bot commented Feb 24, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with. stale? Issue that may be closed soon due to the original author not responding any more.
Projects
None yet
Development

No branches or pull requests

4 participants