Gutenberg custom block validation error due to meta attribute not populated
-
I’m creating some custom blocks for Gutenberg.
The current one I’m working on has some custom attributes stored in meta – the specific one I’m working on right now is called ‘createdDate’.
attributes: { createdDate: { type: 'string', source: 'meta', meta: 'page_created_date' } }
in registerBlockType
I can see that when I save, the value is persisted to the DB.
The value is also displayed in the front end.However, when I next visit that page in the admin section I get a block validation error. It seems to be that
attributes.createdDate
is null until *after* the block validation test at which point it’s populated, meaning the HTML block differs to what’s stored in the DB.Is this expected? Is there a way around it?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Gutenberg custom block validation error due to meta attribute not populated’ is closed to new replies.