ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
27.39k stars 2.28k forks source link

[Bug]: RangeError: Adding different instances of a keyed plugin (plugin$) #4683

Open borstessi opened 11 months ago

borstessi commented 11 months ago

Which packages did you experience the bug in?

starter-kit, react, pm

What Tiptap version are you using?

2.1.13

What’s the bug you are facing?

On opening a page where the tip tap editor is used, i recieve the following error:

Bildschirmfoto 2023-12-11 um 11 37 32


import { useEditor, EditorContent } from '@tiptap/react';
import StarterKit from '@tiptap/starter-kit';

const Tiptap = () => {
  const editor = useEditor({
    extensions: [
      StarterKit.configure({
        gapcursor: false,
        dropcursor: false,
      }),
    ],
    content: '<p>Hello World! 🌎️</p>',
  });

  return <EditorContent editor={editor} />;
};

export default Tiptap;

is the example code

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

Basic example of tiptap editor should be rendered

Anything to add? (optional)

No response

Did you update your dependencies?

Are you sponsoring us?

bdbch commented 11 months ago

Could you try to find out which key is trying to be instanced before this error is caught? For example via the browser debugger.

borstessi commented 11 months ago

Bildschirmfoto 2023-12-12 um 10 15 43

Bildschirmfoto 2023-12-12 um 10 15 39

Bildschirmfoto 2023-12-12 um 10 15 54

Thats all i can get out of the debugger. Looks like there is a plugin with the key "plugin$". Anyone understands this?

Nantris commented 11 months ago

Same problem started here today on 2.2.0-rc.7 which was previously working fine. I can't find any changes at all. I tried clearing node_modules and all caches but the issue persists.

It only affects two of our plugins which are used inside of a codeblock that we .extend() and then .configure()

It only affects those two plugins (out of 190 plugins), and it affects them whether they have keys or not.

It does not affect the plugins if I make them functions like const MyPlugin = () => new Plugin({}) and then use MyPlugin() to invoke it - but like I said this just started out of the blue for these two plugins which is extremely strange and a bit concerning since it occurred without any apparent changes to anything.

Downgrading to 2.1.12 fixes it for us (even though 2.2.0-rc.7 previously worked and nothing seems to have changed).


Edit: 2.1.13 does not have this problem for us (but we're not using StarterKit)

Nantris commented 10 months ago

Filed #4704 for our case.