[iOS]Fix: Oddly formatted text hangs Gutenberg #1352
Merged
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.
Fixes #1354
WPiOS PR
Root Cause Analysis
I used Time Profiler to see what's taking so long and it turns out the enumeration on attributes was taking so long. So I put beginEditing/endEditing calls to make the updates as a batch.
This is still not perfect because it is a very long text but I observed that on a iPhone 6 simulator the opening of the page dropped from ~55secs to ~5secs.
About Text Getting Invisible
Also, you might observe that text appears as invisible. This is a known iOS behavior about rendering very long text inside a non-scrolling UITextView. If you split the block at some point you can observe that the text is visible again. The ideal world for iOS would be allowing the text scroll inside a smaller viewport, that way the text color doesn't get invisible. We had the same issue on HTML mode and I fixed it that way. Although as far as I know real devices are performing better compared to simulators about this, so we might not need to worry a lot currently.
To test:
WPiOS App Tests
Checkout the branch of WPiOS PR
Run
rake dependencies
Follow the instructions in the issue
Verify that the screen is not hanging for a long time
Apart from this, some smoke test is done in paragraph/heading blocks to make sure we are not causing regression.
Update release notes:
RELEASE-NOTES.txt
.