coblocks icon indicating copy to clipboard operation
coblocks copied to clipboard

Undo and Redo editor functions work as expected with the innerBlocks component

Open jrtashjian opened this issue 5 years ago • 0 comments

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:

doubleUndo

This is how it should be working.

Kapture 2019-11-22 at 18 20 37

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

jrtashjian avatar Nov 22 '19 23:11 jrtashjian