Skip to content

feat: Implement LatestContentProvider for WebView recovery#22774

Draft
dcalhoun wants to merge 2 commits intojkmassel/gutenbergkit-settings-refactorfrom
feat/gutenberg-kit-pulls-content-rebased
Draft

feat: Implement LatestContentProvider for WebView recovery#22774
dcalhoun wants to merge 2 commits intojkmassel/gutenbergkit-settings-refactorfrom
feat/gutenberg-kit-pulls-content-rebased

Conversation

@dcalhoun
Copy link
Copy Markdown
Member

@dcalhoun dcalhoun commented Apr 7, 2026

Description

Ref CMM-1123.

This is a rebased version of #22493, targeting the jkmassel/gutenbergkit-settings-refactor branch (#22764) so it can be reviewed/tested on top of the GutenbergKit v0.15.0 upgrade.

Implements GutenbergKit's LatestContentProvider interface for pull-based content recovery.

When the WebView reinitializes (due to OS memory pressure or page refresh), the editor now requests the latest content from the app rather than using stale content from the initial WebView load. This ensures users don't lose their work during WebView recovery.

Changes:

  • Added getPersistedTitle() and getPersistedContent() methods to EditorFragmentListener interface
  • Set up LatestContentProvider on GutenbergView in GutenbergKitEditorFragment
  • Implemented the interface methods in GutenbergKitActivity returning content from EditPostRepository
  • Properly set the post status to avoid unexpectedly emptying post titles

Rebase notes:

  • Dropped 3 obsolete GutenbergKit version-bump commits (target branch already updates to v0.15.0)
  • Dropped the warmup-helper fix commit (warmup is a no-op stub on the new branch pending re-implementation against the v0.15.0 API)
  • Adapted EditorConfigurationBuilder to the new builder API: setStatus(...)setPostStatus(...) and removed the now-redundant setPostType(...) call (postType is a constructor argument)

Related PRs:

Testing instructions

WebView refresh recovery:

  1. Open a post with existing content in the GutenbergKit editor
  2. Make edits to the content (wait 2+ seconds for autosave to persist)
  3. Trigger a WebView refresh: press Cmd+R while the WebView is inspected via the Chrome Inspector at chrome://inspect
  • Verify the editor recovers with the edited content, not the original

dcalhoun added 2 commits April 7, 2026 15:59
Allow GutenbergKit to retrieve the latest content persisted in the host
app as needed. This is important for allowing GutenbergKit to display
the latest content after the WebView reloads or re-initializes from
memory pressure or backgrounding.
@dangermattic
Copy link
Copy Markdown
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@dcalhoun dcalhoun added [Type] Enhancement Posting/Editing Gutenberg Editing and display of Gutenberg blocks. labels Apr 7, 2026
@dcalhoun dcalhoun added this to the 26.8 milestone Apr 7, 2026
@dcalhoun dcalhoun changed the title feat: Implement LatestContentProvider for WebView recovery (rebased on #22764) feat: Implement LatestContentProvider for WebView recovery Apr 7, 2026
@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22774-8e919cc
Build Number1488
Application IDcom.jetpack.android.prealpha
Commit8e919cc
Installation URL7cj6lqg2kccr8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22774-8e919cc
Build Number1488
Application IDorg.wordpress.android.prealpha
Commit8e919cc
Installation URL4bou7ib4plvcg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.40%. Comparing base (6cfa2a2) to head (8e919cc).

Files with missing lines Patch % Lines
...ss/android/ui/posts/GutenbergKitSettingsBuilder.kt 60.00% 2 Missing ⚠️
...ess/android/ui/posts/EditorConfigurationBuilder.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                           Coverage Diff                            @@
##           jkmassel/gutenbergkit-settings-refactor   #22774   +/-   ##
========================================================================
  Coverage                                    37.40%   37.40%           
========================================================================
  Files                                         2320     2320           
  Lines                                       123654   123658    +4     
  Branches                                     16793    16795    +2     
========================================================================
+ Hits                                         46256    46258    +2     
- Misses                                       73687    73689    +2     
  Partials                                      3711     3711           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Editing and display of Gutenberg blocks. Posting/Editing [Type] Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants