Repository navigation
[lexical-table] Bug Fix: $mergeCells no longer keeps the empty paragraph of the target cell - #9122
Merged
etrepum merged 1 commit intoSep 8, 2026
Conversation
…aph of the target cell seenCells is seeded with the target, so the merge loop never runs the empty check on it. A blank top left cell keeps its paragraph and the rest of the content lands underneath. I clear it only when real content is about to land, so an all empty merge never reaches the clear.
Om-singhaI
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
September 7, 2026 03:39
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Sep 8, 2026
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging cells where the top left one is empty leaves a blank line at the top of the merged cell.
One row, two columns, cell 0 empty and cell 1 holding "hello":
$mergeCellsseedsseenCellswith the target cell, so the loop skips it. Every other cell goes through$cellContainsEmptyParagraphand loses its blank paragraph. The target never does.I clear it the first time real content is about to land. If nothing in the range has content the clear never runs, so an all empty merge keeps the paragraph node it started with.
Same limit as the rest of the function: that check only matches a cell holding exactly one empty paragraph, so a target with a blank line plus other content merges the way it does today.
$mergeCellsis exported from@lexical/table, so callers will see the difference.Five tests in
LexicalTableUtils.test.ts, two of which fail on main. The all empty one asserts the paragraph key, so the clear can't be hoisted out of the loop without something failing. 47 pass in the file and the neighbouring table files are unchanged.