Skip to content

fix: restore content-change notifications to the host - #744

Merged
dcalhoun merged 1 commit into
task/demo-app-host-autosavefrom
fix/autosave-monitor-interval
Sep 30, 2026
Merged

dcalhoun merged 1 commit into
task/demo-app-host-autosavefrom
fix/autosave-monitor-interval

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

What?

Fix content change bridge communication events that were never firing after #691.

Why?

The missing events prevent hosts from capturing in-progress edits, which can lead to content loss in the event of a reload or crash.

How?

Explicitly set an AutosaveMonitor interval. Previously, a bug in the upstream Gutenberg core's component resulted in autosaves triggering by coincidence.

Testing Instructions

  1. Open an existing post/page via a site configuration's Browse button.
  2. Make changes to the content.
  3. Verify the Save button becomes enabled within a second or two
  4. Trigger a crash via the Trigger editor crash button in the navigation menu.
  5. Tap Reload.
  6. Verify the unsaved edits remain in place.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.


AI-generated details

Why: onEditorContentChanged stopped firing after #691. @wordpress/editor 15 rewrote AutosaveMonitor, which now skips its checks when no interval is set. GBK never passed one, and hosts never provide the autosaveInterval editor setting (wp-admin sets it from PHP's AUTOSAVE_INTERVAL). The previous monitor tolerated the missing interval by accident: setTimeout( fn, NaN ) polled on a 0ms timer.

How: Pass interval={ 1 } to AutosaveMonitor. A new E2E test stubs window.editorDelegate and asserts the host is notified after an edit.

Testing: With the demo changes from the previous PR in the stack, open an existing post via "Browse" and edit it. Save enables within about a second.

Known issues (not addressed here):

🤖 Generated with Claude Code

https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD

@github-actions github-actions Bot added the [Type] Bug An existing feature does not function as intended label Sep 29, 2026
@dcalhoun
dcalhoun added this pull request to stack #745 September 29, 2026 14:55
@dcalhoun
dcalhoun force-pushed the fix/autosave-monitor-interval branch from 36d286d to 14c7b71 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/744")

Built from 989b3fa

`@wordpress/editor` 15 skips autosave checks when no interval is set.
Hosts never provide the `autosaveInterval` setting, so
`onEditorContentChanged` stopped firing. The previous monitor tolerated
the missing interval by accident, polling on a 0ms timer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A55JP8ZvqUAq4yct9nzckD
@dcalhoun
dcalhoun force-pushed the fix/autosave-monitor-interval branch from 14c7b71 to 989b3fa Compare September 29, 2026 16:24
@dcalhoun
dcalhoun marked this pull request as ready for review September 29, 2026 17:14
@dcalhoun
dcalhoun merged commit cfb88fe into trunk Sep 30, 2026
27 of 28 checks passed
@dcalhoun
dcalhoun deleted the fix/autosave-monitor-interval 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] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants