Automattic / Automattic/jetpack

Simple payments block: unsaved modifications don't get passed onto re-usable block

Open
#11,789 7 comments 0 reactions 1 assignee Claimed by @simison View on GitHub
[Block] Pay With Paypal [Feature] Pay with PayPal [Focus] Blocks [Pri] Normal [Status] Auto-allocated [Status] Priority Review Triggered Bug Customer Report [LEGACY] Earn Triaged
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

Simple payments block as a re-usable block gets emptied if the original block wasn't saved yet in the DB.

#### Steps to reproduce
1. Add Simple payments block (gutenpack-jn)
2. Fill in title

screenshot 2018-11-26 at 18 33 27

3. Turn the block into re-usable block
screenshot 2018-11-26 at 18 33 34

4. All fields are emptied
screenshot 2018-11-26 at 18 33 14

### Notes
- User can still continue modifying the form and fill in all the fields, just original content is missing.

- If user fills in a block fully and it gets saved, also turning it into a re-usable block works.
- If user fills in a block fully and it does NOT get saved, also turning it into a re-usable block fails.
- If user fills on a block, it does get saved, but user then again modifies the block and then turns it into a re-usable block, modifications get lost and only latest saved content is visible in re-usable block.

- Values get emptied in `injectPaymentAttributes` with `simplePayment` object that is empty (i.e. it's the original initialized draft post):
https://github.com/Automattic/wp-calypso/blob/cae358ee8450644be298f663d6cbff07cc51fc57/client/gutenberg/extensions/simple-payments/edit.js#L104-L114

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.