Open rfgamaral opened 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days
What’s the bug you are facing?
When an editor with the Mentions extension is unmounted while having the mention suggestion popup active and selected, this message appears in the console log:
This may not seem like a big problem, and it's not with a normal setup of the Tiptap editor, but we are doing something different where this becomes a real issue: the whole app crashes.
How can we reproduce the bug on our side?
Basic CodeSandbox (https://codesandbox.io/s/tiptap-issue-2547-basic-dnlg89)
Reproduction steps:
@
into the editorCtrl+A
(or macOS equivalent)UNMOUNT
buttonAdvanced CodeSandbox (https://codesandbox.io/s/tiptap-issue-2547-advanced-zi6t1y)
This advanced example mimics the behavior of our app. We have a small editor on the bottom of the page with an expand button. Clicking this button will open an expanded/bigger version of the same editor in a modal (taking most of the screen). The expanded editor in the modal has a collapse button to close the modal, and get back to the smaller editor. But that's not all, we also want to keep the selection state between the toggled states, so if you select a word/sentence/everything in the editor, and switch to an expanded/collapsed state, the selection should be restored (this is working, try it).
Toggling the expanded/collapsed state in this editor is similar to the basic sandbox in the sense that one of the editors is unmounted, and with the "restore selection" functionality we have, the application crashes if a mention suggestion Tippy.js popup is active.
Reproduction steps:
@
into the editorCtrl+A
(or macOS equivalent)EXPAND
buttonWhat did you expect to happen?
There should be no "memory leak" nor application crashes when an editor component is unmounted with a selection active surrounding the trigger character for the mentions extension.
Did you update your dependencies?
Are you sponsoring us?