docs/solutions/logic-errors/2026-05-06-slate-v2-delete-cleanup-must-not-remove-valid-nested-empty-blocks.md
Backspace at the start of a block after a table merged the trailing paragraph away, then corrupted the table shape by deleting a valid empty table cell.
[3, 4, 4].Keep removeEmptyStructuralArtifacts from deleting nested block elements.
The bad cleanup scanned the entire document and removed any empty single-child element. That is too broad: empty nested blocks can be valid model structure, especially table cells.
const isNestedBlock =
NodeApi.isElement(node) &&
path.length > 1 &&
EditorApi.isBlock(editor, node)
if (isNestedBlock) {
return
}
The regression belongs in both layers:
[4, 4, 4];[4, 4, 4].The cleanup helper is allowed to remove transient empty structural artifacts from a delete operation. It is not allowed to globally decide that every empty nested block is garbage.
Table cells, nested list items, quotes, and similar structures can be empty by design. Skipping nested blocks keeps cleanup focused on safe top-level artifacts while preserving valid nested document structure.