Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
mermaid-js#478 API crashes on 2nd render() call
Browse files Browse the repository at this point in the history
- remove element from DOM before rendering to avoid conflicts in case of rerendering
  • Loading branch information
koljatm-edeka committed Oct 15, 2019
1 parent 53bdfee commit 3677ebd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mermaidAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ const render = function(id, txt, cb, container) {
.attr('xmlns', 'http://www.w3.org/2000/svg')
.append('g');
} else {
const existingSvg = document.getElementById(id);
if (existingSvg) {
existingSvg.remove();
}
const element = document.querySelector('#' + 'd' + id);
if (element) {
element.innerHTML = '';
Expand Down

0 comments on commit 3677ebd

Please sign in to comment.