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

Editor: Fix the issue where statics for deprecated components were not hoisted #16152

Merged
merged 1 commit into from
Jun 14, 2019

Conversation

gziolo
Copy link
Member

@gziolo gziolo commented Jun 13, 2019

Description

This issue was discovered in Jetpack plugin, see Automattic/jetpack#12673.

There are a few components which were moved to @wordpress/block-editor package which were marked as deprecated. Unfortunately, they no longer expose statics exposed in the original components. Example:

wp.blockEditor.InnerBlocks exposes also, wp.blockEditor.InnerBlocks.Content

There was only wp.editor.InnerBlocks exposed for backward compatibility which obviously breaks the code in some plugins. This PR fixes it by exposing also missed statics.

How has this been tested?

Open JS console and ensure that all statics are hoisted:

  • BlockControls.Slot
  • BlockFormatControls.Slot
  • InnerBlocks.Content
  • InspectorAdvancedControls.Slot
  • InspectorControls.Slot
  • RichText.Content
  • RichText.isEmpty

@@ -41,7 +41,6 @@ import {
RichText as RootRichText,
RichTextShortcut as RootRichTextShortcut,
RichTextToolbarButton as RootRichTextToolbarButton,
RichTextInserterItem as RootRichTextInserterItem,
Copy link
Member Author

Choose a reason for hiding this comment

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

There is no such component in @wordpress/block-editor ...

@gziolo gziolo added [Type] Regression Related to a regression in the latest release [Type] Bug An existing feature does not function as intended [Package] Editor /packages/editor Backwards Compatibility Issues or PRs that impact backwards compatability labels Jun 13, 2019
@gziolo gziolo self-assigned this Jun 13, 2019
@gziolo gziolo added this to the Gutenberg 5.9 milestone Jun 13, 2019
@aduth
Copy link
Member

aduth commented Jun 13, 2019

Is it something to consider this project, so we don't need to risk human error in specifying individual static properties to hoist?

https://github.com/mridgway/hoist-non-react-statics

@gziolo
Copy link
Member Author

gziolo commented Jun 13, 2019

Is it something to consider this project, so we don't need to risk human error in specifying individual static properties to hoist?

I considered it but I decided that it isn't that much useful in this context because of that whitelisted statics hoisted need to have deprecation logic applied as well. The library you shared only hoists statics and leaves them unchanged.

@gziolo gziolo requested a review from a team June 13, 2019 14:28
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

We can do a quick 5.9.1 with this fix. It should be as easy as cherry-picking this into the release/5.9 branch, pushing into the repository and running ./bin/commander.js stable

@gziolo gziolo merged commit 289e2a1 into master Jun 14, 2019
@gziolo gziolo deleted the fix/editor-statics-not-hoisted-deprecations branch June 14, 2019 06:42
kellymears added a commit to pixelcollective/laravel-mix-wp-blocks that referenced this pull request Jun 14, 2019
gziolo added a commit that referenced this pull request Jun 14, 2019
daniloercoli added a commit that referenced this pull request Jun 14, 2019
…rnmobile/open-video-by-browser-for-android

* 'master' of https://github.com/WordPress/gutenberg: (34 commits)
  [RNMobile] Native mobile release v1.7.0 (#16156)
  Scripts: Document and simplify changing file entry and output of build scripts (#15982)
  Block library: Refactor Heading block to use class names for text align (#16035)
  Make calendar block resilient against editor module not being present (#16161)
  Bump plugin version to 5.9.1
  Editor: Fix the issue where statics for deprecated components were not hoisted (#16152)
  Build Tooling: Use "full" `npm install` for Build Artifacts Travis task (#16166)
  Scripts: Fix naming conventions for function containing CLI keyword (#16091)
  Add native support for Inserter (Ported from gutenberg-mobile) (#16114)
  docs(components/higher-order/with-spoken-messages): fix issue in example code (#16144)
  docs(components/with-focus-return): fix typo in README.md (#16143)
  docs(block-editor/components/inspector-controls): fix image path in README.md (#16145)
  Add mention of on Figma to CONTRIBUTING.md (#16140)
  Bring greater consistency to placeholder text for media blocks. (#16135)
  Add descriptive text and a link to embed documentation in embed blocks (#16101)
  Update toolbar-text.png (#16102)
  Updating changelogs for the Gutenberg 5.9 packages release
  chore(release): publish
  [RNMobile] Fix pasting text on Post Title (#16116)
  Bump plugin version to 5.9.0
  ...

# Conflicts:
#	packages/block-library/src/video/video-player.android.js
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 [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants