-
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
[V2] Hot reload doesn't work on pages deleted and created by onCreatePage #12143
Comments
This might be why it starts failing |
Yes, I can confirm that is the reason. Gatsby 2.1.9 hot reload works fine but 2.1.10 fails, which is the version which corresponds to the merge #11831. I can't exactly say why is the reason though. The page refreshes by itself and renders 404-development after the hot reload. |
I found a way around it that is to only include the Gatsby configBefore
Now
|
Any update on this? I 'm facing the same problem with gatsby 2.1.20 |
Same issue here. Luckily, the workaround from #12143 (comment) proved really helpful. Thanks, @tcerdaITBA. |
Just bumped into this issue while using with I created a source-filesystem-entry
And created an mdx file at
|
Having the same issue. Rolling back to Gatsby v2.1.9 works for now. Thanks @tcerdaITBA |
I've added #12480 to our roadmap so we'll try to fix this asap. If there are any takers we're open to that as well 😄 |
The issue comes from the line const timestamp = new Date().toJSON() that has been updated to const timestamp = Date.now() The comparison is now working and pages are deleted (which was not the case in 2.1.09): if (!_.includes(statefulPlugins, page.pluginCreatorId) && page.updatedAt < timestamp) {
deleteComponentsDependencies([page.path]);
deletePage(page);
} |
One workaround (not sure about all the side effects) is to add a dummy exported function exports.createPagesStatefully = () => {}; or just rename your |
…r edits (#12671) If in `gatsby-node.js` we add ```js 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
Description
Hot reload fails when updating pages deleted and created by
deletePage
andcreatePage
insideonCreatePage
. It renders correctly afternpm start
but it fails to hot reload. Updating any other type of file works correctly.It actually updates correctly but it attempts to refresh the page after 1 second and then it fails.
The idea is to replace pages inside
src/pages
by their i18n version. So/
is deleted and replaced by a component which redirects to/es/
and/en/
. The relevant code is:Steps to reproduce
git checkout a5dff2c4bf3d4fdcc2a05c59294734832a421d3b
npm install
npm start
localhost:8000
src/pages/index.jsx
Expected result
It should render the updated changes without refreshing the page.
Actual result
404-development page is rendered and restarting application is required to fix.
Environment
Additional Information
This started to happen since Gatsby 2.1.10, related to #11831.
I have already tried fixing the React hot load warning but the error persisted.
Thank you very much for your help.
The text was updated successfully, but these errors were encountered: