Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make sure block exists before unregistering #1169

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

miguelpeixe
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

If Jetpack is not installed it currently attempts to unregister a non-existing block and throws an error. This PR adds a check to only unregister a block that is registered.

How to test the changes in this Pull Request:

  1. While on the master branch, deactivate Jetpack
  2. Edit any post/page and confirm the error on the browser console
  3. Check out this branch, build and confirm the error is gone
  4. Reactivate Jetpack and confirm the block is not available, as it's still being unregistered successfully

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@miguelpeixe miguelpeixe self-assigned this Jun 14, 2022
@miguelpeixe miguelpeixe requested a review from a team as a code owner June 14, 2022 19:04
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

Good catch! I had tested with Jetpack not set up, but didn't test without Jetpack active. This fixes the console error.

@miguelpeixe miguelpeixe merged commit 6d3deed into master Jun 15, 2022
@adekbadek adekbadek deleted the fix/unregister-jetpack-check branch June 16, 2022 08:18
matticbot pushed a commit that referenced this pull request Jun 16, 2022
# [1.53.0-alpha.1](v1.52.0...v1.53.0-alpha.1) (2022-06-16)

### Bug Fixes

* **donate:** amount formatting ([c766ce3](c766ce3))
* **homepage posts block:** align items when an odd number of items is inserted ([#1173](#1173)) ([7139567](7139567))
* **iframe-block:** handle errors from server-side fetch ([#1162](#1162)) ([8378b41](8378b41))
* make sure block exists before unregistering ([#1169](#1169)) ([6d3deed](6d3deed))

### Features

* unregister the Jetpack Donation block ([#1163](#1163)) ([6acbcac](6acbcac))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.53.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jun 27, 2022
# [1.53.0](v1.52.0...v1.53.0) (2022-06-27)

### Bug Fixes

* **donate:** amount formatting ([c766ce3](c766ce3))
* **homepage posts block:** align items when an odd number of items is inserted ([#1173](#1173)) ([7139567](7139567))
* **iframe-block:** handle errors from server-side fetch ([#1162](#1162)) ([8378b41](8378b41))
* make sure block exists before unregistering ([#1169](#1169)) ([6d3deed](6d3deed))

### Features

* unregister the Jetpack Donation block ([#1163](#1163)) ([6acbcac](6acbcac))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.53.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants