-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
perf(richtext-lexical)!: significantly reduce lexical rerendering and amount of network requests from blocks #9255
Merged
Conversation
This file contains 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
…amount of network requests from blocks. The field RSC now provides an initial state for all lexical blocks
…e data), instead of dedicated form save plugin. While this adds a delay to the parents form state being updated with the sub form data (due to the debounce), this greatly simplifies things and reduces the amount of re-renders caused by updating the node data
…just kept them pressed down
…ocus out of rich text field
AlessioGr
changed the title
perf(richtext-lexical): significantly reduce lexical rerendering and amount of network requests from blocks. The field RSC now provides an initial state for all lexical blocks
perf(richtext-lexical)!: significantly reduce lexical rerendering and amount of network requests from blocks. The field RSC now provides an initial state for all lexical blocks
Nov 17, 2024
AlessioGr
changed the title
perf(richtext-lexical)!: significantly reduce lexical rerendering and amount of network requests from blocks. The field RSC now provides an initial state for all lexical blocks
perf(richtext-lexical)!: significantly reduce lexical rerendering and amount of network requests from blocks
Nov 17, 2024
🚀 This is included in version v3.0.0-beta.134 |
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.
The field RSC now provides an initial state for all lexical blocks. This completely obliterates any flashes and lexical block loading states when loading or saving a document.
Previously, when a document is loaded or saved, every lexical block was sending a network request in order to fetch their form state. Now, this is batched and handled in the lexical server component. All lexical block form states are sent to the client together with the parent lexical field, and are thus available immediately.
We also do the same with block collapsed preferences. Thus, there are no loading states or layout shifts/flashes of blocks anymore.
Additionally, when saving a document while your cursor is inside a lexical field, the cursor position is preserved. Previously, a document save would kick your cursor out of the lexical field.
Look at how nice this is:
CleanShot.2024-11-16.at.15.38.44.mp4
BREAKING:
This removes the
feature.hooks.load
andfeature.hooks.save
interfaces from custom lexical features, as they weren't used internally and added unnecessary, additional overhead.If you have custom features that use those, you can migrate to using normal payload hooks that run on the server instead of the client.