Skip to content

Commit

Permalink
fix(dev-404-page): route to 404 fails when using plugin-remove-traili…
Browse files Browse the repository at this point in the history
…ng-slashes (#3522)

* fix(dev-404-page): route to 404 fails when using plugin-remove-trailing-slashes

Fixes: #3521

* refactor(dev-404-page): use RegExp.test() as we don't need to return anything

* fix(dev-404-page): route to 404 fails when using plugin-remove-trailing-slashes

updating other occurrence of 404 page check as well
  • Loading branch information
Ahmad Nassri authored and KyleAMathews committed Feb 8, 2018
1 parent f13c1fa commit da572ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby/cache-dir/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function shouldUpdateScroll(prevRouterProps, { location: { pathname } }) {

let noMatch
for (let i = 0; i < pages.length; i++) {
if (pages[i].path === `/dev-404-page/`) {
if (/^\/dev-404-page/.test(pages[i].path)) {
noMatch = pages[i]
break
}
Expand Down Expand Up @@ -174,7 +174,7 @@ const Root = () =>
pageResources,
})
} else {
const dev404Page = pages.find(p => p.path === `/dev-404-page/`)
const dev404Page = pages.find(p => /^\/dev-404-page/.test(p.path))
return createElement(Route, {
key: `404-page`,
component: props =>
Expand Down

0 comments on commit da572ca

Please sign in to comment.