Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit c16be7b

Browse files
vtrifonovsis0k0
authored andcommitted
feat-next: call the page reload just once (#655)
1 parent 605b34e commit c16be7b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hot-loader-helper.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ module.exports.reload = function(type) { return `
22
if (module.hot) {
33
module.hot.accept();
44
module.hot.dispose(() => {
5+
global.__hmrNeedReload = true;
56
setTimeout(() => {
6-
global.__hmrLivesyncBackup();
7+
if(global.__hmrNeedReload) {
8+
global.__hmrNeedReload = false;
9+
global.__hmrLivesyncBackup();
10+
}
711
}, ${type === 'style' ? "global.__hmrInitialSync ? 1000 : 0" : 0});
812
})
913
}
1014
`};
11-
// we need to add a timeout of 1000 if we have a css change, otherwise the app crashes on initial hmr sync
15+
// we need to add a timeout of 1000 if we have a css change, otherwise the app crashes on initial hmr sync

0 commit comments

Comments
 (0)