-
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
feat(gatsby): write match-paths.json #13012
Conversation
57c124a
to
e71c9a5
Compare
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.
I'm unsure about oldPage being set. Rest is looking good.
Do you have a small example how you'll be able to trigger oldPage.matchPath !== page.matchPath
return {} | ||
case `CREATE_PAGE`: { | ||
const page = action.payload | ||
if (page.matchPath) { |
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.
fast returns are easier to read in my opinion
if (page.matchPath) { | |
if (!page.matchPath) { | |
return state; | |
} |
case `CREATE_PAGE`: { | ||
const page = action.payload | ||
if (page.matchPath) { | ||
const { oldPage } = action |
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.
I don't think oldPage is set on the action.
In I.e: - let { program, jsonDataPaths, pages, matchPaths } = store.getState()
+ let { program, jsonDataPaths, pages } = store.getState()
pages = [...pages.values()]
+ const matchPaths = {}
const pagesComponentDependencies = {}
// Write out pages.json
let pagesData = []
pages.forEach(({ path, matchPath, componentChunkName, jsonName }) => {
const pageComponentsChunkNames = {
componentChunkName,
}
if (program._[0] === `develop`) {
pagesComponentDependencies[path] = pageComponentsChunkNames
}
pagesData.push({
...pageComponentsChunkNames,
jsonName,
path,
matchPath,
})
+
+ if (matchPath) {
+ matchPaths[matchPath] = path
+ }
}) |
Apologies, this was a sloppy PR. The |
Fixed in 966f035 |
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.
👍
Description
Writes
match-paths.json
during pages writing. This file contains a map ofmatchPath
->path
. It will be used by #13004 when finding pages in the production-app. See https://github.com/gatsbyjs/gatsby/pull/13004/files#diff-06ce5193de7c2c01dd947a5001c147c3R60 for how it's used.Related Issues