Move some js files into debug/
, implement db corruption detector
This commit is contained in:
parent
c1ab8fe8ae
commit
d65c58fd92
6 changed files with 20 additions and 4 deletions
|
@ -1407,7 +1407,7 @@
|
||||||
<a id="saveLink">savelink</a>
|
<a id="saveLink">savelink</a>
|
||||||
</div>
|
</div>
|
||||||
<script src="https://d3js.org/d3.v7.js"></script>
|
<script src="https://d3js.org/d3.v7.js"></script>
|
||||||
<script type="text/javascript" src="../js/render_compute_graph.js"></script>
|
<script type="text/javascript" src="../js/debug/render_compute_graph.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -67,6 +67,6 @@
|
||||||
<script type="text/javascript" src="/js/utils.js"></script>
|
<script type="text/javascript" src="/js/utils.js"></script>
|
||||||
<script type="text/javascript" src="/js/loadheader.js"></script>
|
<script type="text/javascript" src="/js/loadheader.js"></script>
|
||||||
<script type="text/javascript" src="/js/icons.js"></script>
|
<script type="text/javascript" src="/js/icons.js"></script>
|
||||||
<script type="text/javascript" src="/js/dps_vis.js"></script>
|
<script type="text/javascript" src="/js/debug/dps_vis.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -373,6 +373,15 @@ function init() {
|
||||||
});
|
});
|
||||||
decodeBuild(url_tag);
|
decodeBuild(url_tag);
|
||||||
builder_graph_init();
|
builder_graph_init();
|
||||||
|
for (const item_node of item_nodes) {
|
||||||
|
if (item_node.get_value() === null) {
|
||||||
|
// likely DB load failure...
|
||||||
|
if (confirm('One or more items failed to load correctly. This could be due to a corrupted build link, or (more likely) a database load failure. Would you like to reload?')) {
|
||||||
|
hardReload();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onerror = function(message, source, lineno, colno, error) {
|
window.onerror = function(message, source, lineno, colno, error) {
|
||||||
|
|
|
@ -619,8 +619,15 @@ function addClasses(elem, classes) {
|
||||||
*/
|
*/
|
||||||
async function hardReload() {
|
async function hardReload() {
|
||||||
//https://gist.github.com/rmehner/b9a41d9f659c9b1c3340
|
//https://gist.github.com/rmehner/b9a41d9f659c9b1c3340
|
||||||
|
try {
|
||||||
const dbs = await window.indexedDB.databases();
|
const dbs = await window.indexedDB.databases();
|
||||||
await dbs.forEach(db => { window.indexedDB.deleteDatabase(db.name) });
|
await dbs.forEach(db => { window.indexedDB.deleteDatabase(db.name) });
|
||||||
|
} catch (error) {
|
||||||
|
// Hacky patch for firefox...
|
||||||
|
console.log(error);
|
||||||
|
const db_names = ['item_db', 'ing_db', 'map_db', 'tome_db'];
|
||||||
|
await db_names.forEach(db => { window.indexedDB.deleteDatabase(db) });
|
||||||
|
}
|
||||||
|
|
||||||
location.reload(true);
|
location.reload(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue