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

Fixes block-editor component index to export ButtonBlockAppender with correct name #27709

Closed
wants to merge 2 commits into from

Conversation

gaavar
Copy link
Contributor

@gaavar gaavar commented Dec 14, 2020

Fixes block-editor's component index to export ButtonBlockAppender with the correct name (#25885)

Description

Revised block-editor's component index to export ButtonBlockAppender with the correct name.
ButtonBlockAppender was earlier exported with the incorrect name ButtonBlockerAppender.

Deprecated ButtonBlockerAppender.

How has this been tested?

Screenshots

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Dec 14, 2020
@gziolo gziolo added the Backwards Compatibility Issues or PRs that impact backwards compatability label Dec 14, 2020
@gziolo gziolo requested a review from talldan December 14, 2020 09:38
@gziolo gziolo added the [Package] Block editor /packages/block-editor label Dec 14, 2020
Copy link
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

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

@gaavar Thanks for picking this up!

I think there are two things to address.

Unfortunately there might be plugins importing/using ButtonBlockerAppender, so we should continue to export it. It could be deprecated. That's done by calling the deprecate function. The following will output a console warning:

import deprecated from '@wordpress/deprecated';

deprecated( 'wp.blockEditor.ButtonBlockerAppender', {
	alternative: 'wp.blockEditor.ButtonBlockAppender'
} );

The tricky bit is that the message should only be shown if the user imports ButtonBlockerAppender, so I think you'd want to wrap ButtonBlockAppender, a bit like the following code elsewhere in the codebase, and then export that as ButtonBlockerAppender 😄 :

const Component = forwardRef( ( props, ref ) => {
deprecated( 'wp.editor.' + name, {
alternative: 'wp.blockEditor.' + name,
} );
return <Wrapped ref={ ref } { ...props } />;
} );

The second thing is that there's some documentation associated with the components that needs to be regenerated (which is why the 'Static Analysis' task is failing). It can be regenerated by running npm run docs:build locally and then committing and pushing the results.

@gaavar gaavar requested a review from talldan December 15, 2020 07:35
@talldan
Copy link
Contributor

talldan commented Dec 16, 2020

@gaavar I think there's some misunderstanding of my comment. The deprecation for ButtonBlockerAppender will have to be in the packages/block-editor/src/components/index.js file. I think it's fine to copy some of the code over for deprecating the component from the other file.

Base automatically changed from master to trunk March 1, 2021 15:45
@chrisvanpatten
Copy link
Member

@gaavar Any concern if I pick this task up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block editor /packages/block-editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants