fix(editor): Prevent race condition and ensure correct list continuation on Enter #4716
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.
ScreenRecording_05-22-2025.21-25-45_1.mp4
I am not always able to reproduce it. But this often happens on iOS Safari on my iPhone 13 Pro and iPad Pro M2.
From what I can tell, it seems there is a race condition between the default behaviour of the event handler and the
insertText
to be inserted. It only seems to happen with the task list continuation, maybe because it is slightly longer than the other list continuations.This fix removes the race condition and inserts the newline manually before the
insertText
.After implementing this fix, I don't see this occurring on my devices anymore.
Thanks for considering the fix.