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

Mobile: Fixes #10130: Improve note editor performance when quickly entering text #10134

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Mar 16, 2024

Summary

This fixes #10130 by decreasing the frequency at which Note.tsx updates state.note based on editor events.

Explanation

Previously, the rerender caused by updating note.body could take longer than the time between body updates (for example, on my tablet, when entering text with an external keyboard). This seems to have caused events to queue while waiting for rendering to complete.

Logging just before changing the content of note.body reveals that state can be set several seconds after actually typing the text. (See the description of #10130). As a result, this may also fix issues raised related to the last edit not being saved (e.g. if the user closes the app before Note.tsx works through the backlog of update events).

Screen recordings

Before

before.mp4

Note: The "toggle overflow" button is clicked at roughly 11s. It takes about 20s for the overflow menu to be shown.

After

out.mp4

Testing

  1. Open the editor
  2. Type several sentences very quickly (or use a tool to type it quickly (e.g. adb shell input text)
  3. Click the "toggle overflow" button
  4. Verify that it takes < 1 second to show the overflow menu
  5. Type several sentences very quickly
  6. Click on the back arrow
  7. Verify that the last typed text is saved and that the note editor opened quickl

This has been tested successfully on an Android 12 emulator.

@@ -19,7 +19,6 @@ const injectedJs = {
codeMirrorBundle: require('../lib/rnInjectedJs/codeMirrorBundle.bundle'),
svgEditorBundle: require('../lib/rnInjectedJs/svgEditorBundle.bundle'),
pluginBackgroundPage: require('../lib/rnInjectedJs/pluginBackgroundPage.bundle'),
noteBodyViewerBundle: require('../lib/rnInjectedJs/noteBodyViewerBundle.bundle'),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: This change is from #10132 -- it fixes a startup issue. (Consider reviewing #10132 first).

@laurent22 laurent22 merged commit d260d0e into laurent22:dev Mar 20, 2024
10 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.

Android: Unable to use toolbar or back button for several seconds after quickly typing a few sentences.
2 participants