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

Make labeling of selected text to new entity more reliable. #3

Open
mattmazzola opened this issue Aug 18, 2018 · 0 comments
Open

Make labeling of selected text to new entity more reliable. #3

mattmazzola opened this issue Aug 18, 2018 · 0 comments

Comments

@mattmazzola
Copy link
Owner

Problem:
The button to add a new entity is on the entity picker. This invokes a callback back out to the parent component which contains the editor and it is responsible for creating the new entity, updating its state which then updates the editor with a new available option. The editor naively assumes any new option must have been added due to the button from within itself and assumes whatever text was selected should be labeled as the newly added entity. This is an assumption that's may not be true if new entity is added from outside while the user is interacting with the control.

It would be better if this entity was created and assigned to the selected text in more reliable manner.

Solution?
There might be a better pattern, but one way is to make the new entity prop callback return the new entity that is created. Instead of invoking as fire/forget it will await the creation of the new entity and then assign the selected text to it while still maintain internal execution context.

@mattmazzola mattmazzola changed the title Update to latest version of Slate Make labeling of selected text to new entity more reliable. Aug 18, 2018
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

No branches or pull requests

1 participant