Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Feature: Add missing block implementation #241

Merged
merged 3 commits into from
Aug 3, 2023
Merged

Conversation

jonwaldstein
Copy link
Contributor

@jonwaldstein jonwaldstein commented Aug 1, 2023

Description

This implements the missing block when a previously registered block is not available.

The way this works is that when a block is missing, we replace it with the missing blockType and store the original block type json from the database in the missing blockType's originalContent attribute.

Then, when the block is found again as a registered block, we replace the missing block with the stored originalContent attribute.

Note: this is currently pulling in the WordPress core missing blockType to achieve this. After going through this, I think it might be better to supply our own version to prevent any conflicts in future WP versions.

Affects

  • The form builder and how it handles missing blocks

Visuals

Screenshot 2023-08-01 at 2 58 49 PM

Testing Instructions

  • Install a block extension like fee recovery
  • Create a v3 form, add the fee recovery block and save.
  • Deactivate the fee recovery plugin and go back to the form
  • You should now see a notice about the missing block
  • Now try re-activating the plugin to see the original block
  • Now go de-activate the plugin again and return to the form
  • This time, make a change to the form and save
  • Refresh the form builder and make sure that missing block notice is still there
  • Once again, re-activate the plugin to make sure you see the original block in the form builder
  • You should also see the field on the form front-end without needing to save changes.

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@jonwaldstein jonwaldstein marked this pull request as ready for review August 1, 2023 19:37
@jonwaldstein jonwaldstein requested a review from kjohnson August 1, 2023 19:38
@jonwaldstein
Copy link
Contributor Author

@kjohnson please review this when you get a chance.

Copy link
Contributor

@kjohnson kjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @jonwaldstein thanks for digging into this. We can create an issue for replacing the missing-block with a custom block.

@kjohnson kjohnson changed the title Feature: add missing block implementation Feature: Add missing block implementation Aug 3, 2023
@kjohnson kjohnson merged commit fc83da3 into develop Aug 3, 2023
@jonwaldstein jonwaldstein deleted the feature/missing-block branch August 4, 2023 16:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants