question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API crashes on 2nd render() call

See original GitHub issue

Hey everyone,

I successfully set up my site to read input from a textarea and make it rerender with MermaidAPI. The first time I change the input in the textarea, the graph changes as expected.

But the second time I change the textarea I get the following error:

:WARN: TypeError: Cannot read property ‘v’ of undefined at Object.edgeToId (mermaidAPI.js:10650) at SVGGElement.<anonymous> (mermaidAPI.js:9661) at bind (mermaidAPI.js:851) at Array.d3_selectionPrototype.data (mermaidAPI.js:903) at createEdgeLabels (mermaidAPI.js:9661) at fn (mermaidAPI.js:10401) at Object.exports.draw (mermaidAPI.js:50877) at render (mermaidAPI.js:58254) at Object.exports.render (mermaidAPI.js:58345) at HTMLTextAreaElement.<anonymous> ((index):40)

The code I used is as follows:

$('#cfgTextarea').change(function(emt) {
	var graphStr = emt.target.value;
	var correct = mermaidAPI.parse(graphStr);
	if (correct) {
		var graph = mermaidAPI.render(graphStr);
		$('#mermaidContainer').html(graph);
	} else {
		$('#errorMsg').html('<br/>Wrong.');
	}
});

I am baffled by this weird error and I can’t find out what really caused it. Any ideas?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Mar 13, 2017

render can take 3 parameters. I faced the same problem and corrected it like that (I used Jquery but feel free to do it with JS) :

var callback = function(html) {
    $('#yourMermaidContainer').html(html);
};
mermaid.mermaidAPI.render('SEE_BELOW', 'Your mermaid string', callback);

the value SEE_BELOW has to be changed at every call. You won’t have the error anymore.

1reaction
StingyJackcommented, Mar 27, 2017

@jansennetive consider reopening the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

API crashes on 2nd render() call · Issue #478 · mermaid-js ...
Hey everyone, I successfully set up my site to read input from a textarea and make it rerender with MermaidAPI. The first time...
Read more >
react api response crashes when having a different endpoint ...
I have two endpoints that I need to render, response.data.data1 and response.data.data2 ,. the results array list works fine in the render if...
Read more >
Slow rendering - Android Developers
If your app suffers from slow UI rendering, then the system is forced to skip frames and the user will perceive stuttering in...
Read more >
Maya 2022.3 Crashing On Second Render - Autodesk Forums
It renders the first frame of the sequence and then Maya crashes (basically the window disappears, no Maya crash window). It happens after ......
Read more >
How to filter 1GB JSON on the frontend and not crash ... - Uptech
I had an interesting task: to display 1GB file and 2 million rows of data ... This app just loads some data from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found