Meta values not saved, meta changes to empty array on update #55283
Labels
[Feature] Custom Fields
Anything related to the custom fields project - connecting block attributes and dynamic values
Needs Testing
Needs further testing to be confirmed.
[Type] Bug
An existing feature does not function as intended
Description
I have a block that updates meta values, but when I click 'update', the values are not saved for the post. Additionally, the meta values I get from useEntityProp load as an object with meta key/values, but turns into an empty array when Update is clicked. If I reload the post, old values are still there, but new values are not.
I have a question on Stack Overflow as well with more details: https://wordpress.stackexchange.com/questions/419214/block-editor-meta-values-not-saved-meta-changes-to-empty-array-on-update
Step-by-step reproduction instructions
I followed the Meta Boxes demo exactly:
I registered meta:
I setup a js (and block.json) file for the block:
When I look at the result of
console.log(meta)
on initial load, I get a result of{myguten_meta_block_field: ''}
.If I add 'Some Text' to the TextControl, I get
{myguten_meta_block_field: 'Some Text'}
logged.When I click 'update', I get
[]
- no meta values at all.If I reload, the meta value did not save to
Some Text
.Screenshots, screen recording, code snippet
GutenbergMeta.mp4
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: