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: Unregistering a block type causes blocks that convert to it to break the editor #12192

Conversation

jorgefilipecosta
Copy link
Member

When a block was registered, if we added another block that transformed to it and went to the block switcher the editor may crash.
Fixes: #12001

How has this been tested?

I added a list block.
I remove the quote block: wp.blocks.unregisterBlockType( 'core/quote' );.
I went to the switcher of the quote block, I see the application did crash and the transform to paragraph was available.
I started again; I added a list block; I opened the block switcher; I checked quote and paragraph are available as transforms; I opened the console with the switcher opened, I remove the quote block: wp.blocks.unregisterBlockType( 'core/quote' );and I verified the quote block transform disappeared.

@jorgefilipecosta jorgefilipecosta requested a review from a team November 21, 2018 18:23
@jorgefilipecosta jorgefilipecosta added the [Type] Bug An existing feature does not function as intended label Nov 21, 2018
@jorgefilipecosta jorgefilipecosta added this to the 4.6 milestone Nov 21, 2018
Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

It would be good to add an E2E test for this, but makes sense to me.

@jorgefilipecosta jorgefilipecosta merged commit 89f8897 into master Nov 21, 2018
@jorgefilipecosta jorgefilipecosta deleted the fix/removing-a-block-type-causes-blocks-that-convert-to-it-to-break-the-editor branch November 21, 2018 18:57
@jorgefilipecosta
Copy link
Member Author

Thank you for your review @tofumatt, I'm planning to create an end to end test covering this case, it should be available soon.

jorgefilipecosta added a commit that referenced this pull request Nov 27, 2018
This commit adds tests that make sure the block switcher works correctly even when some blocks are removed.
This test changes should catch the bug fixed in #12192.
@mtias mtias added the [Feature] Block Transforms Block transforms from one block to another label Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Transforms Block transforms from one block to another [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants