-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
editor.selection is delayed so selection is undependable to find current element #3338
Comments
I think I found the cause of the delay and it's in the @ianstormtaylor I noticed that you switched lodash's This differs from The Are you okay with switching back to `lodash's throttle method? |
Hey @thesunny thanks for investigating this. If I remember right, there was some reason I ended up using I think the ideal would be to use neither, and just let the code run very frequently? But I feel like I remember there being an issue with that too (other than performance, which I'm okay to wait and see if it's even a problem). If you can verify that switching to Ideally I'd love to get rid of throttling or debouncing entirely. |
There's two ways to keep the bundle size small.
I tend to use #2 in my code because I get access to other I can use the method you prefer. Note: I do tend to agree that not having to use |
The 2nd one sounds good to me. Yeah I'd love to see both of them removed instead. |
Do you want to request a feature or report a bug?
bug
What's the current behavior?
Press a cursor key and the cursor position is not updated in
editor.selection
for between 100ms and 200ms on a fast computer.This causes funkiness like holding down
tab
in a table. We read the currenttd
and move to the next but because of the slow selection updates, the cursor jumps several times to the sametd
because it is returning the old selection (i.e. cursor has moved but we keep getting thetd
from before the move because of the old selection).Also the cause of other issues to do with cursor movement.
Slate: 0.55.3
Browser: Chrome
OS: Mac
What's the expected behavior?
In earlier Slate like 0.47, the
editor.selection
was updated within arequestAnimationFrame
.The text was updated successfully, but these errors were encountered: