Skip to content

Conversation

@narpat-ps
Copy link
Contributor

fix: resolve "Can't find a Block to remove" error in renderFromHTML

  • Make renderFromHTML async and await BlockManager.clear() to prevent race condition
  • Change removeBlock order: remove from array before destroy to prevent index invalidation
  • Fix clear() method to copy blocks array before iteration to avoid modification during loop

Fixes issue where renderFromHTML would fail with "Can't find a Block to remove" error
due to concurrent block removal operations and array modification during iteration.

Resolves #2518

- Make renderFromHTML async and await BlockManager.clear() to prevent race condition
- Change removeBlock order: remove from array before destroy to prevent index invalidation
- Fix clear() method to copy blocks array before iteration to avoid modification during loop

Fixes issue where renderFromHTML would fail with "Can't find a Block to remove" error
due to concurrent block removal operations and array modification during iteration.

Resolves codex-team#2518
@neSpecc neSpecc merged commit df7d3a7 into codex-team:next Sep 6, 2025
VolgaIgor pushed a commit to VolgaIgor/editor.js that referenced this pull request Nov 11, 2025
…-team#2941)

* fix(blocks):Error occurred when calling renderFromHTML: Can't find a Block to remove.

* fix: resolve "Can't find a Block to remove" error in renderFromHTML

- Make renderFromHTML async and await BlockManager.clear() to prevent race condition
- Change removeBlock order: remove from array before destroy to prevent index invalidation
- Fix clear() method to copy blocks array before iteration to avoid modification during loop

Fixes issue where renderFromHTML would fail with "Can't find a Block to remove" error
due to concurrent block removal operations and array modification during iteration.

Resolves codex-team#2518
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error occurred when calling renderFromHTML: Can't find a Block to remove.

2 participants