-
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
Fix development crasher on file deletion #2546
Conversation
I was not sure what testing is typically done in this project. I verified that redux updates as expected and I am going to wait for CI to see whether any tests need to be updated. |
console.warn(`parsing file ${file}`); | ||
let text; | ||
try { | ||
text = await fs.readFile(file, `utf8`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this change is part of the throwaway commit, I thought I'd call this out. I couldn't reproduce the issue mentioned in the TODO. Seems like the conversion to async io "just works."
Previously, gatsby develop would crash upon deleting a page file. This was happening due to an failed read of a non-existent file, whose name was read from stale state. The root cause was that `DELETE_PAGE` action's component reducer did not remove the state data added by the complementary `CREATE_PAGE` reducer. This change removes the appropriate component state on `DELETE_PAGE` events.
Deploy preview ready! Built with commit 9bd26ac9f8496f1845d1afdc725b71d9af3b728a |
Deploy preview ready! Built with commit ef94550 |
@@ -79,6 +79,7 @@ class Runner { | |||
// FIXME: this should all use gatsby's configuration to determine parsable | |||
// files (and how to parse them) | |||
let files = glob.sync(`${this.fragmentsDir}/**/*.+(t|j)s?(x)`) | |||
console.warn(files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are for debugging right?
Played with this some more and super nice! Nice fix! Cleaning up edge bugs like this really are what makes the UX of a tool shine vs. feeling kinda crappy all the time. Did a bit more work as well to fix returning to the development 404 page after the file was deleted as that wasn't handled correctly either. Thanks for diving in and figuring things out and fixing the problem! |
@@ -19,7 +19,7 @@ | |||
"gatsby-remark-images": "latest", | |||
"gatsby-remark-katex": "latest", | |||
"gatsby-remark-prismjs": "latest", | |||
"gatsby-remark-responsive-iframe": "latest", | |||
"gatsby-remark-responsive-iframe": "^1.4.9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change related to the issue, or is it something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I just ran yarn upgrade in this example site before using it to test your PR
Hiya @mickeyreiss! 👋 This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here. Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! 💪💜 |
Posting 77405d7 as the changes were helpful for my investigation but should not be merged.
See 9bd26ac for a full explanation.
Fixes #2542.
cc/ @KyleAMathews