Automattic / Automattic/jetpack
Paid Content Block: Undo button will not remove the block
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### What is the issue
On a self-hosted site using the Jetpack plugin, once a Paid Content block is added to a post or page it isn't possible to remove it with the undo button. With most other blocks, after adding the block and making none or a few changes, clicking the undo button will undo any changes and then remove the block (as a demo you can try with the Business Hours block).
To reproduce:
- Create a new post or edit a template in the Site editor
- Add the Paid Content block
- Click undo
- Verify the block is not removed
Demo:
https://github.com/Automattic/jetpack/assets/16754605/8a114a07-c3d2-471d-be2e-a51771745115
### Likely next steps
The issue is most likely due to attributes that are being set on first mount, likely within a `useEffect`. This was the case for the Contact Form Block - https://github.com/Automattic/jetpack/pull/36485 - and Donations Block - https://github.com/Automattic/jetpack/issues/37185
Contributor guide
Research direction
Start with the Paid Content block's mount logic, especially any useEffect that sets attributes, and compare it with the Contact Form Block pull request #36485 and Donations Block issue #37185. Reproduce the issue in a new post or the Site editor by adding the block and clicking undo. Done means undo removes the newly added Paid Content block.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100