-
Notifications
You must be signed in to change notification settings - Fork 57
[Android] Gutenberg changes a posts content without informing the UI #2701
Description
Describe the bug
In some cases Gutenberg seems to change a posts content without informing the UI. This causes an WordPress-Android crash only on DEBUG mode with a log message Post had changes that needed to be saved when exiting the editor, and there was NOT an autosave pending. This means that the editor's autosave mechanism failed. indicating that the autosave mechanism failed.
To Reproduce
This is reproduced consistently with the Layout picker feature. You can use the app from wordpress-mobile/WordPress-Android#13105 (use the wasabi build flavor)
Layout Picker should show when creating a new page from My Site or Site Pages the Modal Layout Picker appears.
Steps to reproduce the behavior:
- Run the WPApp in DEBUG mode from the PR above.
- In the My Site screen press the Add(+) floating button
- Select Site page from the bottom menu
- Scroll to the bottom and select the first layout of the Contact pages category
- Press the Create page button
- Wait for the page to load
- Press the back button without editing the page
- Notice that the app crashes
Expected behavior
Gutenberg should inform of the changes preventing the app from crashing.
Screenshots
Comparing the post content reveals differences that seem to occur on the Gutenberg side and are not tracked.
The issue also is reproduced consistently with the layout of the Team pages category. With other supported layouts no crash does not seem to occur.

Smartphone:
- OS: Android
Additional context
Though this seems to occur rarely it might be possible to be reproduced in other cases where the content is set without the user editing it. Such cases are creating posts from the share action, rebloging a post or setting a page layout (as in the reproduction steps above).
