Serial update modification #3283
Unanswered
pedrocalderon
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I'm using Lexical to create a react platform where users can interact with legal documents, we allow users to select and classify parts of the documents, like the image bellow:
The text above is in portuguese, but the important part is the highlighted text with a tag between brackets and the close button at the end.
My problem is that the classification process is an async process, but I want to make the platform very responsive, for that I've created an optimistic update feature and here is were I'm having trouble.
What I'm trying to do is:
editor.updatewith the following logic:My problem is that since I'm inside an
edito.updatethe modifications do not seem to be persisted at the moment when I try to create the new ClassificationNode. Were I would expect to exist only text nodes I can find the old ClassificationNode still in existence. When theeditorStateis committed in fact my old node has been removed, but the new has not being added.The solution that I have considere is simply to wait the node removal to be committed and only then create the new node, but I could not find anywhere how to do that. Is it possible?
Beta Was this translation helpful? Give feedback.
All reactions