Stuck in endless loop (crashes browser)
See original GitHub issueHey Guys,
I’m using the convertToHTML method and I managed to get stuck into an endless loop with it, that crashes the browser. Just wanted you to be aware of it.
This is how I used it:
import{ convertToHTML } from "draft-convert";
const html = convertToHTML(this.state.editorState.getCurrentContent());
The only special thing I do before calling this method was to initialize Draft.js with a raw document ({blocks: [...], entityMap: {}}) that I had stored in my DB (contains bulletpoints). Like this:
var jsonFromDB = {blocks: [...], entityMap: {}};
var blocks = convertFromRaw(jsonFromDB);
var editorState = EditorState.createWithContent(
blocks, decorator
);
this.setState({
editorState: editorState,
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
How do you stop an infinite loop? Tutorial crashed my browser ...
press (ctrl + shift + esc) if on windowsOS to open the task manager then right click your browser icon Chrome ,fireFox and...
Read more >Why does an infinite loop crash the browser? - Reddit
An infinite loop can simply freeze the browser or can crash it, depending on how the code is looped. A simple loop will...
Read more >Browser stuck in infinite loop. - Codecademy
Hello, whenever I try to access 10/12 of jQuery event my browser get stuck in an infinite loop and is never able to...
Read more >Google Chrome gets stuck in a loop
The tab that I'm on crashes and after a few seconds my browser is ready to use again. However, this seems like a...
Read more >Debugging Infinite Loops | CodeHS Knowledge Base
Often, when a program is run and the browser becomes unresponsive and crashes, this means that your student's program contains an infinite loop....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

yeah sorry for not being super helpful yet. I’m going to take the time to reproduce this issue in a JSFiddle next week. My hunch is that the
while-loop inconvertToHTMLis never exiting in this scenario.i think it’d be odd to throw one for that instance without validating the entire structure (which i think is pretty far outside the charter of this project). additionally, i’d expect that these differences are going to cause issues not just with draft-convert but with core draft-js functionality, such as this operation. i think its fair for this project to make the same amount of assumptions as draft-js and have undefined behavior for invalid input.