coblocks
coblocks copied to clipboard
Undo and Redo editor functions work as expected with the innerBlocks component
Describe the bug
When using the template functionality of the innerBlocks component we can run into issues with how the undo and redo editor functions behave. Specifically if we are setting a block attribute when the template changes we are creating two undo snapshots: one when the attribute is set and another when the innerBlocks are updated.
We solved this issue in the Form block here: https://github.com/godaddy-wordpress/coblocks/pull/1128#issuecomment-557731336
We need to investigate other areas we are using the innerBlocks component to implement the same solution where needed.
Screenshots
The bug:
This is how it should be working.
Expected behavior
Clicking undo once should reset the block back to the state before a template was selected. Clicking redo should set the selected template again.
Isolating the problem:
- This bug happens with no other plugins activated
- This bug happens with a default WordPress theme active
- This bug happens without the Gutenberg plugin active
Additional context
WordPress 5.3