Skip to content

fix(editor): Prevent race condition and ensure correct list continuation on Enter #4716

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

Merged
merged 2 commits into from
May 27, 2025

Conversation

jonfk
Copy link
Contributor

@jonfk jonfk commented May 23, 2025

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.

@jonfk jonfk requested a review from boojack as a code owner May 23, 2025 01:42
@jonfk jonfk force-pushed the bugfix-md-list-race-condition branch from c75b52b to 8041706 Compare May 23, 2025 01:51
@jonfk jonfk force-pushed the bugfix-md-list-race-condition branch from 1057d78 to 2469a55 Compare May 27, 2025 01:07
@jonfk jonfk force-pushed the bugfix-md-list-race-condition branch from 2469a55 to a58da4e Compare May 27, 2025 01:11
@jonfk jonfk requested a review from boojack May 27, 2025 11:46
Copy link
Member

@boojack boojack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@boojack boojack merged commit 7c05a9b into usememos:main May 27, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants