Commit 787a110b authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by Tim Neutkens

Fix issue related to 404 and no default exports. (#2063)

Just after a 404 page, if we created a page with
no default exports. It'll throw an error.
And it'll crash internal webpack state.
So, once we have it we need to do a hard reload to recover it.
parent 9121a9d2
...@@ -30,7 +30,16 @@ export default () => { ...@@ -30,7 +30,16 @@ export default () => {
return return
} }
const { err } = Router.components[route] || {} const { err, Component } = Router.components[route] || {}
if (!Component) {
// This only happens when we create a new page without a default export.
// If you removed a default export from a exising viewing page, this has no effect.
console.log(`Hard reloading due to no default component in page: ${route}`)
window.location.reload()
return
}
if (err) { if (err) {
// reload to recover from runtime errors // reload to recover from runtime errors
Router.reload(route) Router.reload(route)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment