Skip to content

Conversation

@sportnak
Copy link

@sportnak sportnak commented Dec 10, 2025

Summary

I was encountering a similar problem to this issue: #2106 but when I unmounted the BlockNoteView.

The problem seems to be that when the view is unmounted, the react view renderer tries to render the node one more time (not sure why). But the node still exists as does the reference, but it has been disconnected from it's parent (the document tree), causing the getBlockFromPos call to fail. So instead catching this failure and early exiting the render method prevents this from happening.

A simple way to test this is to create a schema with a block created using createReactBlockSpec - then add one of those blocks to the blocknote view. If you put the blocknote view in a toggleable state (i.e. in a popout panel) it will throw the cannot find node at position error when you unmount the blocknote view programmatically.

Rationale

Changes

Impact

Testing

Screenshots/Video

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

@vercel
Copy link

vercel bot commented Dec 10, 2025

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

A member of the Team first needs to authorize it.

@sportnak
Copy link
Author

@nperez0111 would love your feedback when you get a chance!

Copy link
Contributor

@justsml justsml left a comment

Choose a reason for hiding this comment

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

🙏

@nperez0111
Copy link
Contributor

I don't think this is a valid solution here either, unfortunately. This is treating the symptom rather than the problem.

The problem here is that the React Renderer has to be asynchronous, so it can technically mount & unmount within the time that it takes to render.

Unfortunately, this is only exposed because of React's StrictMode behavior (which will synchronously mount -> unmount -> mount, to check that renders are strict mode safe), which is unfortunately not actually likely to occur in a production scenario.

We will look into our options for this at a later time, I don't have a good solution for this at this point in time

@nperez0111 nperez0111 closed this Dec 11, 2025
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.

3 participants