Skip to content

task: mirror host autosave in the demo apps - #743

Merged
dcalhoun merged 5 commits into
trunkfrom
task/demo-app-host-autosave
Sep 30, 2026
Merged

dcalhoun merged 5 commits into
trunkfrom
task/demo-app-host-autosave

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

What?

Implement an in-memory persistence for content changes in the demo app.

Why?

Simplify testing content change events to host apps. Without this, broken communication is likely to go unnoticed—e.g., #744.

How?

Hook into the existing content change bridge events to capture change in memory. Configure the editor with a latest content provider to allow the editor to restore in-memory changes after reloads.

Testing Instructions

This is not testable on its own as #744 fixes broken content change bridge communication. Test that instead.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.


AI-generated details

Why: The demo apps ignored onEditorContentChanged, so the regression from #691 (the event stopped firing) went unnoticed until testing WordPress-Android. Unlike the host apps, the demos kept no host-side copy of the content.

What:

  • iOS and Android demos read getTitleAndContent() on each content-change event into an in-memory copy, as a host app's autosave would.
  • Save is enabled only when that copy differs from the last saved copy.
  • The latest-content provider returns the copy, so an editor reload restores unsaved edits.
  • Fixes the Android demo sending the post's original content on a repeat save: getTitleAndContent returns the originalContent it is given when nothing changed since the previous read.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD

@github-actions github-actions Bot added the [Type] Enhancement A suggestion for improvement. label Sep 29, 2026
@dcalhoun
dcalhoun added this pull request to stack #745 September 29, 2026 14:55
@dcalhoun dcalhoun added [Type] Task Issues or PRs that have been broken down into an individual action to take and removed [Type] Enhancement A suggestion for improvement. labels Sep 29, 2026
@dcalhoun dcalhoun changed the title feat: mirror host autosave in the demo apps task: mirror host autosave in the demo apps Sep 29, 2026
dcalhoun and others added 3 commits September 29, 2026 11:00
The demo ignored content-change events, so it could not reveal when they
stopped firing. Mirroring a host app's autosave makes Save track unsaved
changes and lets an editor reload restore them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD
`getTitleAndContent` returns the `originalContent` it is given when
nothing changed since the previous read. Passing the configuration's
content meant a second save without new edits sent the post's original
content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD
The demo ignored content-change events, so it could not reveal when they
stopped firing. Mirroring a host app's autosave makes Save track unsaved
changes and lets an editor reload restore them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD
@dcalhoun
dcalhoun force-pushed the task/demo-app-host-autosave branch from 5138f0a to 3544e5f Compare September 29, 2026 15:00
@wpmobilebot

wpmobilebot commented Sep 29, 2026 •

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/743")

Built from c20c86c

dcalhoun and others added 2 commits September 29, 2026 12:21
Save's task ran off the main thread and wrote state SwiftUI reads on
the main thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD
Undoing back to the opened content sends no content-change event, so
Save stayed enabled after saving that state and a reload restored the
undone text. The Android demo already refreshes its copy on save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD
@dcalhoun
dcalhoun marked this pull request as ready for review September 29, 2026 17:14
@dcalhoun
dcalhoun merged commit 3a320d8 into trunk Sep 30, 2026
24 checks passed
@dcalhoun
dcalhoun deleted the task/demo-app-host-autosave branch September 30, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants