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): make sure 404 and 500 pages inherit stateful status from original page #33544

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ emitter.on(`CREATE_PAGE`, action => {
...storedPage,
path: `/${status}.html`,
},
action.plugin
action.plugin,
action
Comment on lines +35 to +36
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We pass third arg (actionOptions) so that this check

isCreatedByStatefulCreatePages:
actionOptions?.traceId === `initial-createPagesStatefully`,
actually do something.

actionOptions are spread on CREATE_PAGE action itself -

{
...actionOptions,
type: `CREATE_PAGE`,
contextModified,
plugin,
payload: internalPage,
},

)
)
}
Expand Down
3 changes: 1 addition & 2 deletions packages/gatsby/src/utils/changed-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export function deleteUntouchedPages(
if (
(shouldRunCreatePagesStatefully ||
!page.isCreatedByStatefulCreatePages) &&
page.updatedAt < timeBeforeApisRan &&
page.path !== `/404.html`
page.updatedAt < timeBeforeApisRan
) {
store.dispatch(deletePage(page))
deletedPages.push(page.path, `/page-data${page.path}`)
Expand Down