tiptap: NextJS - TipTap breaks Next router

What’s the bug you are facing?

When I navigate to ‘/’ with the nextJS link component from a page where I render the editor I get the following error: NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

How can we reproduce the bug on our side?

Create a React component in NextJS following this tutorial: https://tiptap.dev/installation/nextjs then create a route in Next like /blog/create where you render the editor then create a link to ‘/’ and you will get the following error: NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Can you provide a CodeSandbox?

No response

What did you expect to happen?

I expect to navigate away from any page where the editor is rendered without any errors

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 17 (5 by maintainers)

Most upvoted comments

I also hit this when an editor using a BubbleMenu is unmounted. Adding a <div> around the BubbleMenu (not EditorContent) fixed it for me, following the tip here: https://github.com/ueberdosis/tiptap/issues/3784

When you use bubble menus you require a wrapping element so the component can unmount correctly, yes

I’ve just run into this issue with getting the error when unmounting BubbleMenu and Editor and was wondering if you can point me in the right direction to what I can read to understand why it does this? Yes, wrapping in divs has fixed the issue but I’m trying to understand the cause.

Still has it I think

Could reproduce this issue with Next.js and Tiptap (+BubbleMenu extension). Adding a <div> around <EditorContent> solved it.

When you use bubble menus you require a wrapping element so the component can unmount correctly, yes

Hey @rgbskills, thanks for your bug report. Could you give more information? (For example what kind of marks or nodes are used?

I tried to replicate the bug with a super simple editor but it worked just fine. (See video)

https://user-images.githubusercontent.com/6538827/163281870-863e3567-088d-478b-93eb-28ae068b6371.mp4