InnerBlocks template causes extra blocks to disappear on editor reload #9349
Labels
[Feature] Nested / Inner Blocks
Anything related to the experience of nested/inner blocks inside a larger container, like Group or P
Describe the bug
I'm using the
InnerBlocks
component in a block in which I want to allow only a single specific block type to be used as children, however as many times as necessary. Gutenberg's own columns block is similar in the way that only thecore/column
block is allowed as child, however different as in that there is a template set that must not be changed (viatemplateLock
set to 'all').As I understand from the documentation, the
templateLock
prop sets whether/how the template can be modified. And when I set it tofalse
, I can duplicate blocks, add new blocks, remove blocks as expected. However, when reloading the editor, it only shows the (number of) blocks that the original template would allow.To Reproduce
Create a block such as the following:
As you can see, by default three image blocks are placed inside the outer block. You can add further ones, and they will save correctly. They will show up on the frontend too. However, when you reload the editor window, you will only see the first three inner blocks as before, as for some reason it always sets back to the template. The properties of them will still be in place, but the extra blocks will simply have vanished. And after saving again, of course they're then no longer present in the frontend as well.
Note that removing blocks is not an issue, they will be gone as expected. Only additional blocks are affected.
Expected behavior
When a template is given and
templateLock
is set to false, additional blocks should show up as expected when reloading the editor.Additional context
The text was updated successfully, but these errors were encountered: