-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use a single method to retrieve title and content from Gutenberg #15508
Use a single method to retrieve title and content from Gutenberg #15508
Conversation
This modifies the API used to retrieve both the title and serialized content from the Gutenberg editor from one event, and includes Gutenberg changes to synchronize access to the latch used to suspend execution in the mechanism awaiting response.
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
…r-the-bridge # Conflicts: # build.gradle
You can test the changes on this Pull Request by downloading the APKs: |
String content = (String) mEditorFragment.getContent(oldContent); | ||
String title, content; | ||
// To reduce redundant bridge events emitted to the Gutenberg editor, we get title and content at once | ||
if (mEditorFragment instanceof GutenbergEditorFragment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ I'm wondering if we need this if
statement. Both Guteneberg fragment and Aztec fragment provide getTitleAndContent(..)
method, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I refactored the implementation to remove getTitle
method from the interface (since it is no longer used anywhere), and now that method is private in Aztec. This allows us to simplify this and remove the conditional here.
This is no longer an interface method and can be made private.
Since Aztec and Gutenberg can both use the same interface method, there is no longer a need to condition on the fragment instance type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @mkevins 👍
I tested with WordPress/gutenberg#36072 (review) on a Pixel 5 (Android 12) and everything worked as expected. The code changes also LGTM 🎉
Thank you for reviewing and testing! |
Related PRs:
gutenberg
: WordPress/gutenberg#36072gutenberg-mobile
: wordpress-mobile/gutenberg-mobile#4182Description
This synchronizes the content retrieval mechanism for serializing content from the editor, and includes title and content in a single event. See WordPress/gutenberg#36072 for more details.
Regression Notes
Potential unintended areas of impact
Autosave behavior
What I did to test those areas of impact (or what existing automated tests I relied on)
Manual testing was conducted as part of a task force to address ongoing issues with the autosave mechanism.
What automated tests I added (or what prevented me from doing so)
These changes involve modifications to the mechanism to serialize content over the bridge to address a race condition. Creating the necessary configuration to test integration of our React Native bridge implementations and protocols is out of scope for the autosave task force project, however, this could be very valuable as a future project.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.