Skip to content

Commit a87f1bd

Browse files
authoredMar 2, 2020
fix(gatsby): fix codepaths that result in js errors (#21829)
1 parent dc484eb commit a87f1bd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎packages/gatsby/cache-dir/loader.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ const createComponentUrls = componentChunkName =>
353353
export class ProdLoader extends BaseLoader {
354354
constructor(asyncRequires, matchPaths) {
355355
const loadComponent = chunkName =>
356-
asyncRequires.components[chunkName]().then(preferDefault)
356+
asyncRequires.components[chunkName]
357+
? asyncRequires.components[chunkName]().then(preferDefault)
358+
: Promise.resolve()
357359

358360
super(loadComponent, matchPaths)
359361
}

‎packages/gatsby/cache-dir/navigation.js

+3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ const navigate = (to, options = {}) => {
8484
if (!pageResources || pageResources.status === `error`) {
8585
window.history.replaceState({}, ``, location.href)
8686
window.location = pathname
87+
clearTimeout(timeoutId)
88+
return
8789
}
90+
8891
// If the loaded page has a different compilation hash to the
8992
// window, then a rebuild has occurred on the server. Reload.
9093
if (process.env.NODE_ENV === `production` && pageResources) {

0 commit comments

Comments
 (0)
Please sign in to comment.