Automattic / Automattic/jetpack
Simple payments block: unsaved modifications don't get passed onto re-usable block
- 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

3. Turn the block into re-usable block

4. All fields are emptied

### 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
Assessment
This issue has not been assessed yet.