[Bug]: Multiple usage of useEditor (react) do not respect different extension usages per instance #4784
Closed
1 of 2 tasks
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Type: Bug
The issue or pullrequest is related to a bug
Which packages did you experience the bug in?
react
What Tiptap version are you using?
2.1.16
What’s the bug you are facing?
I have this sandbox to demonstrate my issue.
I am creating a react component wrapper for the usage of useEditor to make consistent API and UI among my team. When using 2 of these at the same time, I discovered that once an extension is registered on one instance, it would be applied to another that did NOT register it. Is there a fix for this? Any way around it?
I actually discovered this while testing a headless version with jest. One would think that between tests that it would not preserve the registered extension in a new test with a new instance, and yet it does.
What browser are you using?
Chrome
Code example
https://codesandbox.io/p/devbox/tiptap-multiple-useeditor-instances-dtx286?file=%2Fsrc%2FApp.tsx%3A8%2C32&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clrb6swby00073b6ki53yz1q8%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clrb6swby00023b6khxjlcokl%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clrb6swby00043b6kpy9nahq8%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clrb6swby00063b6ksueol8sw%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clrb6swby00023b6khxjlcokl%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clrb6swbx00013b6k87ehjafh%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252FREADME.md%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522clrb6y3w200023b6k92t6zxrl%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A6%252C%2522startColumn%2522%253A1%252C%2522endLineNumber%2522%253A6%252C%2522endColumn%2522%253A1%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FRichTextEditor.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522clrb7f1xp00023b6kghbcrf4c%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A8%252C%2522startColumn%2522%253A32%252C%2522endLineNumber%2522%253A8%252C%2522endColumn%2522%253A32%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FApp.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clrb6swby00023b6khxjlcokl%2522%252C%2522activeTabId%2522%253A%2522clrb7f1xp00023b6kghbcrf4c%2522%257D%252C%2522clrb6swby00063b6ksueol8sw%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clrb6swby00053b6kw2qqisbh%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A5173%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clrb6swby00063b6ksueol8sw%2522%252C%2522activeTabId%2522%253A%2522clrb6swby00053b6kw2qqisbh%2522%257D%252C%2522clrb6swby00043b6kpy9nahq8%2522%253A%257B%2522id%2522%253A%2522clrb6swby00043b6kpy9nahq8%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clrb6swby00033b6kxy0pmcq0%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clrb6swby00033b6kxy0pmcq0%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D
What did you expect to happen?
Each instance should have completely separate extensions.
Anything to add? (optional)
No response
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: