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

Initialize editor before setting event handlers #4916

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ondrejsevcik
Copy link

Please describe your changes

Currently, the editor is initialized after the callback bindings are hooked up. The two useEffect call order should be swapped. The one that hooks up callbacks is run first, then the one where the instance is created is run second. This means there is an attempt to set bindings when the editor does not exists. And once it is created, it needs to re-render and hook up the callbacks again.

How did you accomplish your changes

Moving useEffect that creates editor instance to be the first one to run.

How have you tested your changes

I have tested it with my basic editor. I haven't run extensive testing.

How can we verify your changes

It should still work the same way it does now from API and user perspective. There will be just one less re-render on initial mount.

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Copy link

netlify bot commented Feb 23, 2024

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 0e6d39a
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/65dc893cb7371c0008152775
😎 Deploy Preview https://deploy-preview-4916--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 configuration.

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

Successfully merging this pull request may close these issues.

None yet

1 participant