Skip to content

Commit a987928

Browse files
committed
fix(dev-server): fix reloading same error on start
1 parent 6ec2cf9 commit a987928

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/compiler/build/init-index-html.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,22 @@ const APP_LOADING_HTML = `
188188
189189
setInterval(function() {
190190
try {
191+
var url = window.location.pathname + '?' + Math.random();
191192
var xhr = new XMLHttpRequest();
192193
xhr.addEventListener('load', function() {
193194
try {
194-
if (this.responseText.indexOf('app-dev-first-build-loader') === -1) {
195-
window.location.reload(true);
195+
if (this.status < 300) {
196+
if (this.responseText.indexOf('app-dev-first-build-loader') === -1) {
197+
window.location.reload(true);
198+
}
199+
} else if (window.location.pathname !== '/') {
200+
url = '/' + Math.random();
196201
}
202+
197203
} catch (e) {
198204
console.error(e);
199205
}
200206
});
201-
var url = window.location.pathname + '?' + Math.random();
202207
xhr.open('GET', url);
203208
xhr.send();
204209
} catch (e) {

0 commit comments

Comments
 (0)