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

Refactor BlockCompare block to use React hooks #22909

Merged
merged 3 commits into from
Jun 5, 2020

Conversation

truchot
Copy link
Contributor

@truchot truchot commented Jun 4, 2020

Description

Related #22890

How has this been tested?

  1. Edit page or post
  2. Go to editor code
  3. Code wrong block
  4. Save content
  5. Refresh page
  6. Message "This block contains unexpected or invalid content." will appear
  7. Click on "Resolve" button

Types of changes

Refactor BlockCompare to use React hooks.

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.

@ZebulanStanphill ZebulanStanphill added [Package] Block editor /packages/block-editor [Type] Code Quality Issues or PRs that relate to code quality Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code labels Jun 4, 2020
Copy link
Member

@ZebulanStanphill ZebulanStanphill left a comment

Choose a reason for hiding this comment

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

LGTM (looks good to merge)!

import { getSaveContent, getSaveElement } from '@wordpress/blocks';

/**
* Internal dependencies
*/
import BlockView from './block-view';

class BlockCompare extends Component {
getDifference( originalContent, newContent ) {
function BlockCompare( {
Copy link
Member

@ZebulanStanphill ZebulanStanphill Jun 4, 2020

Choose a reason for hiding this comment

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

Nitpick: you could do export default function here instead of later:

Suggested change
function BlockCompare( {
export default function BlockCompare( {

@youknowriad youknowriad merged commit e724276 into WordPress:master Jun 5, 2020
@github-actions github-actions bot added this to the Gutenberg 8.3 milestone Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code [Package] Block editor /packages/block-editor [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants