Skip to content

Save typed field values when the datastore is enabled - #615

Merged
cbravobernal merged 1 commit into
trunkfrom
claude/fix-datastore-saves
Dec 3, 2026
Merged

cbravobernal merged 1 commit into
trunkfrom
claude/fix-datastore-saves

Conversation

@cbravobernal

Copy link
Copy Markdown
Member

With the datastore enabled, field values typed in the block editor were not saved. Saving kept the values the post was loaded with.

The datastore updates its store on the change_field JS action, but nothing in the plugin fires that action. This PR listens for change events on the page instead, and only updates fields the store tracks, so SCF fields in block forms are not mixed in. The old listener stays for any code that fires change_field.

To test:

  1. Enable the datastore (add_filter( 'acf/settings/enable_datastore', '__return_true' );).
  2. Add a text field to posts, type a value in the block editor and save the draft.
  3. Reload. The value should still be there. On trunk it is empty.

The new e2e test tests/e2e/datastore.spec.ts does these steps. It fails on trunk and passes with this change.

No linked issue.

Use of AI Tools

Claude Code (Claude Opus 5.5) found the cause, wrote the fix and the e2e test, and checked it in the browser.

🤖 Generated with Claude Code

The datastore updated its values on the change_field action, but
nothing fires that action. Field changes never reached the store, so
saving from the block editor kept the old values. Listen for change
events on the page instead, only for fields the store tracks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cbravobernal
cbravobernal merged commit 81667bb into trunk Dec 3, 2026
19 checks passed
@cbravobernal
cbravobernal deleted the claude/fix-datastore-saves branch December 3, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant