Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: merging cells onto already merged cells throws error #6599

Closed
wants to merge 2 commits into from

Conversation

rilrom
Copy link
Contributor

@rilrom rilrom commented Sep 5, 2024

Description

Closes #4470, #5853.

This fix ensures that the merge cells button does not appear when attempting to merge already merged cells onto unmerged cells. This prevents an error from appearing which eventually causes the table to be unusable.

I do see potential for being able to merge already merged cells onto unmerged cells in certain situations, but that should be revisited separately, for now resolving the error is the priority.

Test plan

  1. Create a table.
  2. Attempt to merge already merged cells onto unmerged cells.
  3. The merge cells button should not appear in the table action menu.

Copy link

vercel bot commented Sep 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 4:32pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 4:32pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 5, 2024
Copy link

github-actions bot commented Sep 5, 2024

size-limit report 📦

Path Size
lexical - cjs 29.66 KB (0%)
lexical - esm 29.48 KB (0%)
@lexical/rich-text - cjs 38.07 KB (0%)
@lexical/rich-text - esm 31.32 KB (0%)
@lexical/plain-text - cjs 36.65 KB (0%)
@lexical/plain-text - esm 28.66 KB (0%)
@lexical/react - cjs 39.83 KB (0%)
@lexical/react - esm 32.75 KB (0%)

@etrepum
Copy link
Collaborator

etrepum commented Sep 5, 2024

I think the priority here should be test coverage, to confirm that this does actually fix the issue and to make it easier to properly fix the edge case that this fix is avoiding. If the problem is just that the selection is getting lost, I think that should be straightforward to fix properly.

@rilrom
Copy link
Contributor Author

rilrom commented Sep 6, 2024

I think the priority here should be test coverage, to confirm that this does actually fix the issue and to make it easier to properly fix the edge case that this fix is avoiding. If the problem is just that the selection is getting lost, I think that should be straightforward to fix properly.

Understood, I will create a regression test for it.

@rilrom rilrom reopened this Sep 6, 2024
@etrepum
Copy link
Collaborator

etrepum commented Sep 6, 2024

After looking closer I think the correct fix here is #6607 but will take some time to write additional tests and probably fix another edge case or two while I'm in there

@rilrom
Copy link
Contributor Author

rilrom commented Sep 7, 2024

After looking closer I think the correct fix here is #6607 but will take some time to write additional tests and probably fix another edge case or two while I'm in there

If you've managed to allow for merging already merged cells onto unmerged cells without throwing an error then I absolutely agree that's the better fix here.

This has been a relatively long-standing issue so I'm glad I was able to get the discussion rolling.

I'll do some testing on your PR, thanks @etrepum.

Edit: closing this PR in favour of #6607.

@rilrom rilrom closed this Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: merging two merged cell --> Error #19: selection has been lost
3 participants