Add basic fallback error to real apps when client library fails to load

This commit is contained in:
Andrew Kingston 2021-07-06 18:37:21 +01:00
parent 414a7dbee6
commit 197d895174
1 changed files with 43 additions and 1 deletions

View File

@ -34,13 +34,55 @@
*:after {
box-sizing: border-box;
}
#error {
position: absolute;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
display: none;
font-family: "Source Sans Pro", sans-serif;
flex-direction: column;
justify-content: center;
align-items: center;
background: #222;
text-align: center;
padding: 2rem;
gap: 2rem;
}
#error h1,
#error h2 {
margin: 0;
}
#error h1 {
color: #ccc;
font-size: 3rem;
font-weight: 600;
}
#error h2 {
color: #888;
font-weight: 400;
}
</style>
</svelte:head>
<body id="app">
<div id="error">
<h1>There was an error loading your app</h1>
<h2>
The Budibase client library could not be loaded. Try republishing your
app.
</h2>
</div>
<script type="application/javascript" src={clientLibPath}>
</script>
<script type="application/javascript">
loadBudibase()
if (window.loadBudibase) {
window.loadBudibase()
} else {
console.error("Failed to load the Budibase client")
document.getElementById("error").style.display = "flex"
}
</script>
</body>