Open
Conversation
* Use useEditorState to get components to update themselves when editor is updated * Upgrade to react 19 for development so the demo site can be compiled with react compiler this does mean using babel not swc for now * Make useRichTextEditorContext always return an Editor not null | undefined * Make outer components not render if useEditor returns undefined per V2 of tiptap # Conflicts: # src/controls/MenuButtonHighlightColor.tsx
4cf84ea to
5862f19
Compare
…nds if memoized will be out of order
Contributor
Author
|
I think this may also allow turning off |
Owner
|
Yes, a primary reason to use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the project to use
useEditorStateto get components updated when the editor changes state so projects using react compiler will pick up these changes. It also upgrades to react 19 and switches from the react-swc to just the plain react plugin in vite to enable react compiler for the demo.It also makes useRichTextEditorContext always return an Editor instance which is required by useEditorState instead of allowing undefined. It protects the outer components from rendering if there is no editor provided in order to still be safe.
I confirmed at the beginning of development that the demo was indeed broken when I intially turned on the compiler, for example the add link feature and buttons not updating when the active element changed. It now works correctly.
useEditorStateis also recommended in the docs and example components in @tiptap/react.https://tiptap.dev/docs/guides/performance#use-useeditorstate-to-prevent-unnecessary-re-renders