Skip to content

fix: custom blocks may error when it is re-created #336

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

Closed
wants to merge 1 commit into from

Conversation

teyc
Copy link

@teyc teyc commented Sep 4, 2023

The custom block wrapper attempts to read the block id of the inner block using getPos(), but the inner block has not been initialized by tiptap yet. Do not attempt to render this block until it is ready

The custom block wrapper attempts to read the block id of the inner block using getPos(), but the inner block has not been initialized by tiptap yet. Do not attempt to render this block until it is ready
@vercel
Copy link

vercel bot commented Sep 4, 2023

@teyc is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

@matthewlipski
Copy link
Collaborator

Hey, do you have a code snippet or sandbox where the error gets thrown? Can't seem to reproduce it on my end

@teyc
Copy link
Author

teyc commented Sep 22, 2023

Thanks for having a look: sample here: https://github.com/teyc/custom-blocknote-bug

@matthewlipski
Copy link
Collaborator

Alright I've found the root cause of the issue, so should be able to fix it without needing a workaround. Basically, the editor's content is set before the underlying TipTap editor is done initializing, so any custom blocks which use the BlockNote editor's functions will fail to render. Should be able to fix it by just waiting for the TipTap editor before setting the initial content, just varifying with @YousefED👍

@matthewlipski
Copy link
Collaborator

Gonna close this PR and merge #348 since it fixes the root issue and works for both vanilla and React custom blocks, but thanks for bringing this bug to light and helping with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants