fix navigation jank in debug environments with live reloading

This commit is contained in:
liquidex 2024-11-24 20:07:26 +01:00
parent bcae0ec6f7
commit c54b0629b7

View file

@ -1,8 +1,14 @@
// 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
// connection. Then we reload the page.
let shouldReload = true;
addEventListener("beforeunload", () => {
shouldReload = false;
});
await fetch("/dev/live-reload/stall").catch(async () => {
while (true) {
while (shouldReload) {
try {
let response = await fetch("/dev/live-reload/back-up");
if (response.status == 200) {