-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: add support for gatsby-source-graphql #32
fix: add support for gatsby-source-graphql #32
Conversation
Sorry for the size of this PR, @graysonhicks - it was just stuck in my head and I had to get it out. 😆 Check it out, see what you think... |
Sorry this has taken me a while to get back, but this looks great and I am leaning towards accepting it. Basic thought is that being able to work with gatsby-source-graphql is more important for now than the nested arrays behavior. I believe the nested arrays behavior could be added in the future. So I would definitely do this as a major version bump and add very documentation for those in version 2. |
No worries. Obviously, it's up to you whether you want to go the direction of this PR or not. I could not dream up a use-case where separating the image source URL field from the newly created Do you have a concrete example of a schema in mind that this PR would not support (that the current version does support)? Just curious. |
No, I don't have the schema in mind. I just know that was one of the first features that issues started popping up for. After thinking of it more and reading the recent #33 I do think this PR is the way to go. I can do a merge and new 3.0.0 release after the Christmas/New Year holidays. Also, I think ignore the conflict in here for now since it is conflicting with #34 which is a v2 fix. |
I just rebased, should be a clean merge when it's time. |
I have tried using this in my largeish project (3k pages) instead of the currently released version. Benefits: it actually works. The current implementation is very fragile especially in development mode (I've had issues with the caching part, stale images when nodes are updated and stuff like that) Problems:
This is not this plugin's fault, but we could try to improve.the situation. On thw one hand, we could consider asking gatsby to allow to modify the query concurrency with an env variable or something. I don't know what other unintended consequences that may have though... On the other hand, we've decided we'll be using an ad-hoc solution for our case. We use a CMS that changes the image urls whenever an image is modified, making our image urls effectively immutable. Hence, we are going to implement an extra caching layer, separate from gatsby's cache (that gets cleared in many situations), and just copy the images from there once they've been downloaded at some point in the past. If we see good results from that I will opem a separate ticket to see if there's interest in integrating this possibility as a plugin option or something like that. |
Great feedback, thanks @kilburn. I completely agree we should handle the first issue. The second issue is a bummer and I'm not sure how to best handle it. If I understand it right, the time in the life cycle when this (Gatsby schema customization) runs is by design, so I'm not sure how to get around the slowness other than a Gatsby change similar to what you suggested. |
BREAKING CHANGE: See the migration guide for details.
Yea, thanks for the feedback @kilburn . In general, image processing and downloading is by far the slowest part of the Gatsby build processes. I'm curious if you are saying this plugin in particular is going slower than getting the same images with the same settings using another source plugin? |
I'm afraid I have to come back with bad news. I said before that build times had tripled with this new approach. This is true, but only in What's more, we've implemented the "out-of-gatsby" caching I explained before. This reduced our That is, there's something really wrong with the |
Interesting. Perhaps this is the wrong approach after all - or we're missing something? |
I've done a few more experiments. Here are the timings I'm getting now (using latest versions of all gatsby plugins and our out-of-gatsby caching of images):
Observations:
I'll keep researching the issue, but for the moment our decision is to keep using the code in this PR combined with our out-of-gatsby image cache. This code makes |
Gonna close this as |
BREAKING CHANGE: See the migration guide for details.
Closes #7