Automattic / Automattic/jetpack

Payment Buttons Block: Undo button will not remove the block

Open
#37,187 2 comments 0 reactions 0 assignees View on GitHub
[Block] Payment Button [Pri] Low [Status] Stale
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 Payment Buttons 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 Payment Buttons block
- Click undo
- Verify the block is not removed

Demo:

https://github.com/Automattic/jetpack/assets/16754605/9506f110-9604-475c-849f-d2880196bbd6

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

Open the contributing guide

Research direction

Start with the Payment Buttons block implementation and inspect attributes set during its initial mount, especially any useEffect logic. Compare the behavior with the Contact Form Block pull request #36485 and Donations Block issue #37185. Reproduce the listed editor steps and consider the work done when Undo removes the newly added block.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, wordpress
Domain
frontend, payments
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.