Skip to content

Commit 40a04f7

Browse files
committed
fix: catch viz.js render async error and recreate Viz instance
Signed-off-by: Max Wu <[email protected]>
1 parent b260093 commit 40a04f7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

public/js/extra.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require('prismjs/components/prism-gherkin')
3131

3232
require('./lib/common/login')
3333
require('../vendor/md-toc')
34-
const viz = new window.Viz()
34+
let viz = new window.Viz()
3535
const plantumlEncoder = require('plantuml-encoder')
3636

3737
const ui = getUIElements()
@@ -379,8 +379,13 @@ export function finishView (view) {
379379
$ele.addClass('graphviz')
380380
$value.children().unwrap()
381381
})
382+
.catch(err => {
383+
viz = new window.Viz()
384+
$value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
385+
console.warn(err)
386+
})
382387
} catch (err) {
383-
$value.unwrap()
388+
viz = new window.Viz()
384389
$value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
385390
console.warn(err)
386391
}

0 commit comments

Comments
 (0)