fix navigation jank in debug environments with live reloading
This commit is contained in:
parent
bcae0ec6f7
commit
c54b0629b7
|
@ -1,8 +1,14 @@
|
||||||
// NOTE: The server never fulfills this request, it stalls forever.
|
// NOTE: The server never fulfills this request, it stalls forever.
|
||||||
// Once the connection is closed, we try to connect with the server until we establish a successful
|
// Once the connection is closed, we try to connect with the server until we establish a successful
|
||||||
// connection. Then we reload the page.
|
// connection. Then we reload the page.
|
||||||
|
|
||||||
|
let shouldReload = true;
|
||||||
|
addEventListener("beforeunload", () => {
|
||||||
|
shouldReload = false;
|
||||||
|
});
|
||||||
|
|
||||||
await fetch("/dev/live-reload/stall").catch(async () => {
|
await fetch("/dev/live-reload/stall").catch(async () => {
|
||||||
while (true) {
|
while (shouldReload) {
|
||||||
try {
|
try {
|
||||||
let response = await fetch("/dev/live-reload/back-up");
|
let response = await fetch("/dev/live-reload/back-up");
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
|
|
Loading…
Reference in a new issue