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

[lexical-table] [lexical-selection] Try to fix calling split on undefined #6746

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

ivailop7
Copy link
Collaborator

@ivailop7 ivailop7 commented Oct 20, 2024

Second highest error rate leading to editor crashes we are observing is the following error:
"Cannot read properties of undefined (reading "split")..."
Unfortunately, I don't know how to reproduce the error.

Have gone through the whole codebase and everywhere we call 'split' and have narrowed it down to 3 places (insertRawText method + the 2 in this PR), my gut feeling is that it's probably the table cell method, but the other 2 also could do with the defensive if statement.

EDIT: Will start only with the table plugin and CSS parsing edits

Copy link

vercel bot commented Oct 20, 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 Oct 20, 2024 9:56pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 20, 2024 9:56pm

@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 Oct 20, 2024
Copy link

github-actions bot commented Oct 20, 2024

size-limit report 📦

Path Size
lexical - cjs 29.94 KB (0%)
lexical - esm 29.78 KB (0%)
@lexical/rich-text - cjs 38.51 KB (0%)
@lexical/rich-text - esm 31.58 KB (0%)
@lexical/plain-text - cjs 37.16 KB (0%)
@lexical/plain-text - esm 29 KB (0%)
@lexical/react - cjs 40.29 KB (0%)
@lexical/react - esm 33 KB (0%)

@ivailop7 ivailop7 changed the title Try to fix calling split on undefined [lexical-table] Try to fix calling split on undefined Oct 20, 2024
@ivailop7 ivailop7 changed the title [lexical-table] Try to fix calling split on undefined [lexical-table] [lexical-selection] Try to fix calling split on undefined Oct 20, 2024
@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Oct 20, 2024
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love adding defensive code that ignores input when the types are wrong, it's just hiding some incorrect cast somewhere else if these are anywhere near the actual problem. Maybe a better option would be to add a typeof string invariant to getStyleObjectFromRawCSS if that's a suspect and then you'd at least know that's where the failure is?

The textDecoration case seems awfully unlikely because that looks like a DOM node and those shouldn't have these kinds of surprises

@ivailop7
Copy link
Collaborator Author

I don't love adding defensive code that ignores input when the types are wrong, it's just hiding some incorrect cast somewhere else if these are anywhere near the actual problem. Maybe a better option would be to add a typeof string invariant to getStyleObjectFromRawCSS if that's a suspect and then you'd at least know that's where the failure is?

The textDecoration case seems awfully unlikely because that looks like a DOM node and those shouldn't have these kinds of surprises

Agreed, but I think for these 2 the changes make sense.

@ivailop7 ivailop7 added this pull request to the merge queue Oct 21, 2024
Merged via the queue into facebook:main with commit 6e299aa Oct 21, 2024
45 of 46 checks passed
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. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants