Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix: InnerBlock templates sync conditions to avoid a forced locking #9674
The InnerBlocks component executed block sync with the template each time the component mounted (or each time the component updated if the template changed).
During the document load, the InnerBlocks component is mounted again. So we had a bug even if a block used templateLock=false if blocks were added in an InnerBlocks area with a template during the load all the additional blocks were removed because of the sync.
How has this been tested?
I used the following test block https://gist.github.com/jorgefilipecosta/9ca39e388f6c46881809f0323f681197 and I checked that if I added new blocks e.g: a paragraph after saving and reloading the blocks are still present in the inner blocks area.
referenced this pull request
Sep 17, 2018
Is there any chance we can get this included in 3.9? We're using templates heavily, and the forced-sync issue blocks us from using Gutenberg in production. Currently, if anyone opens a Gutenberg-edited page in the editor, and re-saves, content will be lost due to the forced sync (when the content is loaded into the editor.
If there was any way to get this fix included in 3.9 we would be mightily appreciative!
The code here seems fine but this could use an E2E test to make sure we don't hit a regression because this is probably not a common manual test case and I don't think it's a super-common use case for many users.
Feel free to ping me again if you want review on the E2E test, but please do add a test before merging