Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion Utility] Tippy.js: Potential memory leak with the mentions extension #2547

Open
2 tasks done
rfgamaral opened this issue Feb 18, 2022 · 3 comments
Open
2 tasks done
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@rfgamaral
Copy link
Contributor

rfgamaral commented Feb 18, 2022

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:

image

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:

  1. Expand the CodeSandbox console (if it's not already)
  2. Type @ into the editor
  3. Select everything with Ctrl+A (or macOS equivalent)
  4. Click the UNMOUNT button
  5. Observe the "potential memory leak" in the console

Advanced 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:

  1. Type @ into the editor
  2. Select everything with Ctrl+A (or macOS equivalent)
  3. Click the EXPAND button
  4. Observe the error on the screen

What 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?

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

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖 (on behalf of Doist)
@rfgamaral rfgamaral added the Type: Bug The issue or pullrequest is related to a bug label Feb 18, 2022
@rfgamaral rfgamaral changed the title Tippy.js: Potential memory leak with the mentions extension [Suggestion Utility] Tippy.js: Potential memory leak with the mentions extension Mar 1, 2022
@philippkuehn philippkuehn self-assigned this Apr 4, 2022
@stale
Copy link

stale bot commented Jul 6, 2022

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.

@stale stale bot added the stale label Jul 6, 2022
@stale stale bot closed this as completed Jul 14, 2022
@rfgamaral rfgamaral mentioned this issue Sep 15, 2022
10 tasks
@bdbch bdbch reopened this Sep 15, 2022
@bdbch bdbch added this to the 2.0.0 milestone Sep 15, 2022
@bdbch bdbch assigned bdbch and unassigned philippkuehn Sep 15, 2022
@bdbch bdbch removed this from the 2.0.0 milestone Feb 23, 2023
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Jun 18, 2023
@bdbch bdbch removed the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Jun 18, 2023
@bdbch bdbch added this to Tiptap Aug 4, 2023
@bdbch bdbch moved this to Triage open in Tiptap Aug 4, 2023
@bdbch bdbch moved this from Triage open to Triage Done in Tiptap Aug 4, 2023
@bdbch
Copy link
Member

bdbch commented Dec 4, 2024

Applied no-fix to this as we will phase out Tippy in the future and replace it with FloatingUI

@bdbch bdbch removed their assignment Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Status: Triage Done
Development

No branches or pull requests

3 participants