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.

[Bug] - Error during delete a block by index

See original GitHub issue

I’ve installed the v2.18 to try the new feature about deleting specific block by index. I can notice that now I see a warning if I try to delete a block by an invalid index…ok, but now I see this error:

Instead, if I try to delete though the same code the firt element It seems work fine…

Cannot read property 'lastInput' of undefined Steps to reproduce:

  1. Create a new editor instance
  2. As first block (for example), insert a paragraph with something write
  3. As second one insert a paragraph too
  4. call after adding the second one the following code: this.api.blocks.getBlockByIndex(1);

Expected behavior: The block should be removed.

Screenshots: editorjs-error

main.js is the file where I call the delete function.

Device, Browser, OS: Chrome v83.0.4103.61, Windows 10

Editor.js version: 2.18

Issue Analytics

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

github_iconTop GitHub Comments

stephenrichardcommented, Aug 11, 2020

@ranemihir I reproduce the issue with those steps :

  1. Create a new editor instance (with sample data, 2 blocks is enough)
  2. Do not edit, focus or add a block in the editor
  3. Call editorInstance.blocks.delete(1) (I use a button next to the editor to delete a specific blocks) Note that any valid index triggers the error, an invalid or missing id triggers a simple warning
gohaberegcommented, Aug 27, 2020

Resolved by #1218

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a "Fatal error: Index out … | Apple Developer Forums
I've debugged this through and through on Ventura and the element of the array I delete a receipt group from is deleted properly,...
Read more >
46391 – Cannot remove block[ 11024 ]
I have customer file (included as attachment) that causes an java. io. IOException: Cannot remove block[ 11024 ]; out of range[ 0 -...
Read more >
Error while creating index.html - Mobirise Forums
This last time, I was trying to use mbr-popupblock and I deleted it. The popup block is no longer appearing on my page...
Read more >
How to remove bad blocks from the database using dbrpr
After running dbrpr, run a full index rebuild on the database. Having reformatted blocks and possibly deleted bad records either index entries ...
Read more >
Why does deleting an allocated array cause a memory error?
The problem is in the insert method. When you are copying the existing elements up to make space for the new element, you...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found