Skip to content

Commit a3f83ae

Browse files
committed
Fix edge case in /_app HMR. Fixes #4620
1 parent b1a299e commit a3f83ae

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

client/webpack-hot-middleware-client.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import Router from '../lib/router'
44

55
const handlers = {
66
reload (route) {
7+
// If the App component changes we have to reload the current route, this is handled by hot-self-accept-loader
8+
// So we just return
9+
if (route === '/_app') {
10+
return
11+
}
12+
713
if (route === '/_error') {
814
for (const r of Object.keys(Router.components)) {
915
const { err } = Router.components[r]
@@ -16,12 +22,6 @@ const handlers = {
1622
return
1723
}
1824

19-
// If the App component changes we have to reload the current route
20-
if (route === '/_app') {
21-
Router.reload(Router.route)
22-
return
23-
}
24-
2525
// Since _document is server only we need to reload the full page when it changes.
2626
if (route === '/_document') {
2727
window.location.reload()
@@ -32,9 +32,9 @@ const handlers = {
3232
},
3333

3434
change (route) {
35-
// If the App component changes we have to reload the current route
35+
// If the App component changes we have to reload the current route, this is handled by hot-self-accept-loader
36+
// So we just return
3637
if (route === '/_app') {
37-
Router.reload(Router.route)
3838
return
3939
}
4040

0 commit comments

Comments
 (0)