godaddy-wordpress / godaddy-wordpress/coblocks

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

Open
#1,161 0 comments 0 reactions 1 assignee Claimed by @gmays View on GitHub
[Priority] Low [Type] Bug Good First Issue
Dominant language
JavaScript
Stars
794
Forks
142
PR merge metrics
No merged PRs in 30d

Description

### 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](https://user-images.githubusercontent.com/375788/69547914-65f62d80-0f64-11ea-9690-ec9301e916b2.gif)

This is how it should be working.

![Kapture 2019-11-22 at 18 20 37](https://user-images.githubusercontent.com/375788/69467719-4dfd8e80-0d57-11ea-9500-49c4173a7270.gif)

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.