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.

Editor breaks regularly on multiple block-deletion :: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

See original GitHub issue

I’m running into a bug and I can’t seem to find a sound solution for it. I’m presently working on some sort of workaround as the project I’m working on is a little pressing. But this is a relatively large stumbling block as it’s being designed for non-technical users.

What is the current behavior? The editor will break, unpredictably, when handling deletions of multiple blocks at once. Again, unpredictably. I can’t seem to reproduce the problem reliably, but can usually cause it to occur when I make an effort to do so.

To be more specific about the case, the users will be pasting large amounts of text from inDesign (with formatting) into the editor. I set the editor to strip formatting, but it retains all hard breaks – which is a bit of a pain, but I’ve created another solution for that as well.

However when you couple a number of incidental hard breaks with the error above, it creates a great problem for users as the editor will fault out and I have no way yet of forcing a hard reset on only the encapsulating component.

I’m sure there are issues with my code, but it’s been a bit rushed.

I am either running into this error, or another that states cannot 'getLength' of undefined. I’m assuming this is checking for cursor position inside of a block that has been removed?

Screen shot of error Screen shot of error

The version in the picture is the implemented version which varies slightly, but not crucially. The general codebase is here: https://github.com/Robert-Fairley/draftjs-litho-editor And I’ve got a demo of it here: https://robert-fairley.github.io/draftjs-litho-editor/ You won’t get an error dialog in that version yet, but it will happily flood your console for you. 😛

It’s not really released, but figured I’d put it out there anyway.

What is the expected behavior? Ideally, no error thrown. Or if an error is thrown but the editor can persist in functioning or at least handle an isolated re-render or reset that doesn’t require reloading the entire page (it contains other fields that the user would lose if they had filled them out prior to the editor breaking.)

I can share the fully implemented version on a more private basis. I’m a little bound by the difficult navigation of large-company copyright/intellectual property issues.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Current. Have only used the current version. Every browser. Only tested macOS so far.

Any help or insight is appreciated! I’d like to be able to package and release it in the end.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
rahul1995commented, Apr 16, 2020

See this solution. #1320 (comment)

Why is that fix not handling auto-scroll? Check this: https://github.com/samuelmeuli/mini-diary/issues/47

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute removeChild on Node - Stack Overflow
Your myCoolDiv element isn't a child of the player container. It's a child of the div you created as a wrapper for it...
Read more >
Tried to edit a page: Error: Failed to execute 'removeChild' on ...
I am pretty new to all this so very confused. Error: Failed to execute 'removeChild' on 'Node': The node to be removed is...
Read more >
Bountysource
Editor breaks regularly on multiple block-deletion :: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of...
Read more >
Node.removeChild() - Web APIs
Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node . If the...
Read more >
Timeline - WebKit Trac
new-run-webkit-tests --release fails to build release DRT when global ... are nodes with wrappers in a detached tree whose root does not
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