Skip to content

Unrelated meta data gets saved with default value #6505

@ocean90

Description

@ocean90

Issue Overview

If you have a block which stores its data in post meta and also registered other post meta for REST API usage, the other post meta gets also updated with the default value.

Steps to Reproduce (for bugs)

  1. Example plugin: https://gist.github.com/ocean90/7431114b689f1e0686f4f5dfa88838df
  2. Activate plugin
  3. Add the new block and fill the input
  4. Save draft and inspect the save request
  5. Notice that the meta entry includes all three meta keys while only one has been changed

Expected Behavior

Only changed meta data should get saved.

Possible Solution

I'm not sure yet if that's a limitation of the REST API and/or if Gutenberg can enhance that behaviour.

Related Issues

Todos

  • Tests
  • Documentation

Metadata

Metadata

Assignees

Labels

REST API InteractionRelated to REST API[Feature] BlocksOverall functionality of blocks[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions