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

fix(extension/placeholder): Resolve placeholder performance issues #3361

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

C-Hess
Copy link
Contributor

@C-Hess C-Hess commented Oct 27, 2022

Fix #3360

The issue seems to be caused by this line in placeholder.ts:

isEmpty is NOT a simple operation, but uses JSON stringify on the entire document to verify emptiness compared to the default of the given node type.

This wouldn't be too bad on it's own, but it's called for every descendent, causing noticeable performance issues if more than a few empty paragraphs exist on a large document (even on the Moby Dick large text example).

The issue was actually fixed with #2665 but was then reverted by 1024892 for an unknown reason

Credit to @BrianHung for the more efficient empty editor check

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 4bc4736
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/635a3f9176ece4000847ed8f
😎 Deploy Preview https://deploy-preview-3361--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@C-Hess C-Hess force-pushed the bug/fix-placeholder-empty-perf branch from 5b60278 to 4bc4736 Compare October 27, 2022 08:21
@bdbch bdbch merged commit 6e5d19f into ueberdosis:main Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance issues with Placeholder and documents with empty paragraphs
3 participants