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

fix(gatsby): keep track of pages created by stateful createPages after edits #12671

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Mar 19, 2019

If in gatsby-node.js we add

exports.onCreatePage = ({ actions, page }) => {
  actions.createPage(page)
}

Next time any node update, pages created by gatsby-plugin-page-creator will be deleted. This is regression introduced by fix in #11831 (that fixed the problem of pages never getting deleted)

The problem is that when we do createPage by plugin/site that isn't implementing createPagesStatefully it will be marked to be deleted.

This change keeps track if original API was createPages or createPagesStatefully by using traceId instead of directly checking what plugin created the page in the end.

Fixes #12143

@wardpeet
Copy link
Contributor

a fix and code cleanup is always a good thing! 👍

@khades
Copy link

khades commented Mar 20, 2019

Easiest way to break development environment with this regression is to use gatsby-plugin-remove-trailing-slashes.

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just tested with the repro of the issue and it works like a charm!

Thanks @pieh you're the best!

@wardpeet wardpeet merged commit 62f0d10 into gatsbyjs:master Mar 20, 2019
@khades
Copy link

khades commented Mar 21, 2019

It was just released, and it works like charm, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[V2] Hot reload doesn't work on pages deleted and created by onCreatePage
3 participants