I was working on a Gutenberg project today as I did every day. Although all scripts ran without any problems and I ended up with a validation error. How could that be?
My scripts
I’ve actually changed everything on the Gutenberg Core what you can change.
- All blocks have been given new attributes.
- All blocks have got a sidebar.
- All getSaveElement functions have been filtered.
When I used a block, it was saved normally, but when I used a self-written block, which uses Gutenberg’s innerBlocks function, I got a validation error.
The solution
To solve the problem I changed the order of how the scripts are executed and it helped immediately.
I first enqueued the scripts that manipulate the blocks. This means the block filters. After that I have enqueued my registerBlockType functions. This solved the problem.