-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
EnsureResources, doesn't ensure resources #19959
Comments
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. Thanks for being a part of the Gatsby community! 💪💜 |
Up to the team if this is stale, but do want to make sure that it was seen. The bug is fairly clear (even if a repro isn't) when you look at the code. |
@jquense thanks for the bug report! This is absolutely not stale and a real bug. We are currently a bit overloaded with post-holiday catch up. Is this something you're interested in submitting a PR? If you don't have the capacity for it we'll try to get to this in the next few weeks. Seems like the PR could be relatively straight-forward:
Gatsby still supports early versions of React, so we are unable to use hooks in our runtime components as of yet. Let me know what if you'll be able to get to this or not! |
I'd be happy to write the PR if i get a second, but it'd be unlikely i'd have the correct context or codebase knowledge to write an effective test. At the moment there is really no rush on fixes this as (AFAICT) it practically only shows up to cover a real error, e.g. missing page info. |
@jquense I was looking into this and I'm not certain I see the issue. Did you run into this or did you just identify it while looking through the code? From what I see, we initialize pageResources in the constructor by synchronously loading the resources for a given path. If we implemented a componentDidMount check, it would fail in the same way that the initial state setting would fail if there is actually indeed a problem.
|
I did encounter this when pages were in a bad state, e.g. everything built and compiled but page data was missing or in an error state. The error this throws is really confusing, It could totally be the case that the problem here is that you actually can't ensure page resources, and this should fail more gracefully |
I see. That helps to have that knowledge. I’ll work on this some more and figure out if that’s the problem and we can improve messaging. |
@blainekasten FYI i can reproduce this fairly easily one a gatsby site with no pages. e.g. empty pages directory. which is a confusing error |
Description
https://github.com/gatsbyjs/gatsby/blob/de3f32375da061977513e15b5e81cb2b4628135b/packages/gatsby/cache-dir/ensure-resources.js
SCU is called on updates, not on Mount, so if there are no resources, initially they are never fetched.
Steps to reproduce
Unclear how you set up the case where there are no resources, but it seems to be when pages are in
status: "error"
Expected result
it should do work in componentDidMount to kick off updates if needed. Or use a hook
Actual result
What happened.
Environment
System:
OS: macOS Mojave 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Shell: 5.7.1 - /usr/local/bin/zsh
Binaries:
Node: 12.13.0 - /var/folders/4c/08vnt0sx6zg3djdt5ln5rjk00000gp/T/yarn--1575565990280-0.563851784977069/node
Yarn: 1.19.1 - /var/folders/4c/08vnt0sx6zg3djdt5ln5rjk00000gp/T/yarn--1575565990280-0.563851784977069/yarn
npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
Languages:
Python: 2.7.16 - /Users/jquense/.pyenv/shims/python
Browsers:
Chrome: 78.0.3904.108
Firefox: 69.0.1
Safari: 13.0.3
The text was updated successfully, but these errors were encountered: