Skip to content

Commit 10da223

Browse files
fix: infinity refresh on warnings (#4006)
1 parent 171dba9 commit 10da223

File tree

7 files changed

+469
-5
lines changed

7 files changed

+469
-5
lines changed

client-src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ const onSocketMessage = {
183183
if (needShowOverlayForWarnings) {
184184
show("warning", warnings);
185185
}
186-
187-
reloadApp(options, status);
188186
},
189187
errors(errors) {
190188
log.error("Errors while compiling. Reload prevented.");

package-lock.json

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
"body-parser": "^1.19.0",
7575
"core-js": "^3.12.1",
7676
"css-loader": "^5.2.4",
77+
"css-tree": "^1.1.3",
78+
"csstree": "^0.0.3",
7779
"eslint": "^8.0.1",
7880
"eslint-config-prettier": "^8.3.0",
7981
"eslint-config-webpack": "^1.2.5",

test/client/index.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ describe("index", () => {
206206
onSocketMessage.warnings([]);
207207

208208
expect(overlay.show).toBeCalled();
209-
expect(reloadApp).toBeCalled();
210209
});
211210

212211
test("should run onSocketMessage.error", () => {

test/e2e/__snapshots__/overlay.test.js.snap.webpack4

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,69 @@ exports[`overlay should not show initially, then show on an error, then show oth
342342
"
343343
`;
344344

345+
exports[`overlay should show a warning after invalidation: overlay html 1`] = `
346+
"<body>
347+
<div
348+
id=\\"webpack-dev-server-client-overlay-div\\"
349+
style=\\"
350+
position: fixed;
351+
box-sizing: border-box;
352+
inset: 0px;
353+
width: 100vw;
354+
height: 100vh;
355+
background-color: rgba(0, 0, 0, 0.85);
356+
color: rgb(232, 232, 232);
357+
font-family: Menlo, Consolas, monospace;
358+
font-size: large;
359+
padding: 2rem;
360+
line-height: 1.2;
361+
white-space: pre-wrap;
362+
overflow: auto;
363+
\\"
364+
>
365+
<span>Compiled with problems:</span
366+
><button
367+
style=\\"
368+
background: transparent;
369+
border: none;
370+
font-size: 20px;
371+
font-weight: bold;
372+
color: white;
373+
cursor: pointer;
374+
float: right;
375+
\\"
376+
>
377+
X</button
378+
><br /><br />
379+
<div>
380+
<span style=\\"color: rgb(227, 96, 73)\\">WARNING</span><br /><br />
381+
<div>Warning from compilation</div>
382+
<br /><br />
383+
</div>
384+
</div>
385+
</body>
386+
"
387+
`;
388+
389+
exports[`overlay should show a warning after invalidation: page html 1`] = `
390+
"<body>
391+
<script type=\\"text/javascript\\" charset=\\"utf-8\\" src=\\"/main.js\\"></script>
392+
<iframe
393+
id=\\"webpack-dev-server-client-overlay\\"
394+
src=\\"about:blank\\"
395+
style=\\"
396+
position: fixed;
397+
inset: 0px;
398+
width: 100vw;
399+
height: 100vh;
400+
border: none;
401+
z-index: 2147483647;
402+
\\"
403+
></iframe>
404+
</body>
405+
"
406+
`;
407+
345408
exports[`overlay should show a warning and error for initial compilation and protects against xss: overlay html 1`] = `
346409
"<body>
347410
<div
@@ -891,6 +954,69 @@ exports[`overlay should show an ansi formatted error for initial compilation: pa
891954
"
892955
`;
893956

957+
exports[`overlay should show an error after invalidation: overlay html 1`] = `
958+
"<body>
959+
<div
960+
id=\\"webpack-dev-server-client-overlay-div\\"
961+
style=\\"
962+
position: fixed;
963+
box-sizing: border-box;
964+
inset: 0px;
965+
width: 100vw;
966+
height: 100vh;
967+
background-color: rgba(0, 0, 0, 0.85);
968+
color: rgb(232, 232, 232);
969+
font-family: Menlo, Consolas, monospace;
970+
font-size: large;
971+
padding: 2rem;
972+
line-height: 1.2;
973+
white-space: pre-wrap;
974+
overflow: auto;
975+
\\"
976+
>
977+
<span>Compiled with problems:</span
978+
><button
979+
style=\\"
980+
background: transparent;
981+
border: none;
982+
font-size: 20px;
983+
font-weight: bold;
984+
color: white;
985+
cursor: pointer;
986+
float: right;
987+
\\"
988+
>
989+
X</button
990+
><br /><br />
991+
<div>
992+
<span style=\\"color: rgb(227, 96, 73)\\">ERROR</span><br /><br />
993+
<div>Error from compilation</div>
994+
<br /><br />
995+
</div>
996+
</div>
997+
</body>
998+
"
999+
`;
1000+
1001+
exports[`overlay should show an error after invalidation: page html 1`] = `
1002+
"<body>
1003+
<script type=\\"text/javascript\\" charset=\\"utf-8\\" src=\\"/main.js\\"></script>
1004+
<iframe
1005+
id=\\"webpack-dev-server-client-overlay\\"
1006+
src=\\"about:blank\\"
1007+
style=\\"
1008+
position: fixed;
1009+
inset: 0px;
1010+
width: 100vw;
1011+
height: 100vh;
1012+
border: none;
1013+
z-index: 2147483647;
1014+
\\"
1015+
></iframe>
1016+
</body>
1017+
"
1018+
`;
1019+
8941020
exports[`overlay should show an error for initial compilation: overlay html 1`] = `
8951021
"<body>
8961022
<div

0 commit comments

Comments
 (0)