Mobile: Resolves #9377: Don't attach empty drawings when a user exits without saving #9386
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.
Summary
Previously, clicking "Draw picture"
This pull request changes that behavior to the following:
This prevents empty drawings from being attached to a note when the user clicks "discard changes" or "close" without ever saving the drawing.
Note
This is a partial fix that only applies to the note viewer.
The CodeMirror editor requires a reference to insert text (used for attaching the drawing). This reference is not available while the image editor is visible. This pull request thus only applies the fix in the case where the note viewer is open.
Note.tsx
will likely require refactoring for a more complete fix. (For example by making the CodeMirror editor watch itsinitialText
prop for changes or to send theinsertText
command to the editor by changing a prop).Resolves #9377.
Testing plan
chrome://inspect
location.reload()
in the consoleThis has been successfully tested on an Android 12 emulator.