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

Mutation observer for "onChange" event is re-enabled to early when loading large document #2867

Open
WolfBearGames opened this issue Nov 10, 2024 · 0 comments

Comments

@WolfBearGames
Copy link

WolfBearGames commented Nov 10, 2024

When replacing the editor contents by calling "render()" the MutationObserver that detects changes should be deactivated and reactivated after the new content has been rendered. It seems the async render() method just uses a 2000ms timer, so when a document takes longer to render the MutationObserver is re-enabled too early and there are hundreds of calls to "isMutationBelongsToElement()" that bay continue multiple seconds and creating 100% cpu load.

Steps to reproduce:

  1. load a document using render()
  2. load another very lange document using render()
  3. look at the Chrome performance monitor or record a performance profile and look at the many calls.

Expected behavior:
when rendering a new document the Editor makes sure that the new content has been fully rendered before re-activating the MutationObserver.

Editor.js version:
2.30.6

Plugins you use with their versions:
not relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants