Summary: The existing loading page was not behaving the way it was intended. The previous implementation triggered a page reload which made the whole retry mechanism useless. Instead, a new endpoint was defined to expose whether the server is ready or not. Use this instead as a way of knowing whether we are good to reload the page. Reviewed By: passy Differential Revision: D49314749 fbshipit-source-id: eb67765d7deab8610fa5d31e710070da43a18c1c
73 lines
1.5 KiB
HTML
73 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<title>Loading...</title>
|
|
|
|
<style>
|
|
body {
|
|
font-family: system-ui;
|
|
font-size: 13px;
|
|
cursor: default;
|
|
overflow: hidden;
|
|
line-height: 1;
|
|
}
|
|
|
|
#container {
|
|
-webkit-app-region: drag;
|
|
z-index: 999999;
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
padding: 50px;
|
|
overflow: auto;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 20px;
|
|
color: #525252;
|
|
text-align: center;
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<div id="container">
|
|
<div>
|
|
Loading...
|
|
</div>
|
|
|
|
</div>
|
|
<script>
|
|
// The loading page is shown until the server is ready to accept incoming
|
|
// connections. Poll until the server is ready and returns
|
|
// the actual entry point instead of this page.
|
|
async function checkAndReload() {
|
|
try {
|
|
const response = await fetch('/ready');
|
|
if (response.status >= 200 && response.status < 300) {
|
|
const data = await response.text();
|
|
const {isReady} = JSON.parse(data);
|
|
if (isReady) {
|
|
window.location.reload();
|
|
return;
|
|
}
|
|
}
|
|
} catch {
|
|
}
|
|
window.setTimeout(checkAndReload, 1000);
|
|
}
|
|
checkAndReload();
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|