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

getting TypeError: Cannot read properties of undefined (reading 'type') #1082

Open
imkrrish opened this issue Sep 17, 2024 · 1 comment
Open
Labels
bug Something isn't working prio:high High priority

Comments

@imkrrish
Copy link

Describe the bug
getting TypeError: Cannot read properties of undefined (reading 'type')

To Reproduce

  1. set trailingBlock: false
  2. now add any of image, audio, video, file at the last block from slash menu then getting this error in console.
@imkrrish imkrrish added the bug Something isn't working label Sep 17, 2024
@matthewlipski matthewlipski added the prio:high High priority label Sep 25, 2024
@nikkimontoya
Copy link

nikkimontoya commented Oct 15, 2024

I ran into the same problem just randomly clicking in the editor with some text in it. It crashes here.

Apparently, the problem is in this expression e.getSelection()?.blocks || [e.getTextCursorPosition().block] in useSelectedBlocks. I guess, of e.getSelection()?.blocks returns an empty array, we need to take [e.getTextCursorPosition().block], but in current implementation we won't since [] == true.

Or maybe we just need to check if block is undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working prio:high High priority
Projects
None yet
Development

No branches or pull requests

3 participants