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

Update blocks categories #110

Closed
wants to merge 1 commit into from
Closed

Conversation

fullofcaffeine
Copy link

@fullofcaffeine fullofcaffeine commented Jul 4, 2020

Changes proposed in this Pull Request:

  • Update the category names for relevant blocks in block-experiments.
  • Adds a helper function that is used to safely update category names while still supporting old environments

Related PRs

Testing instructions:

Atomated tests
  • yarn test
To manually test the changes
  1. Setup a local Wordpress instance (i.e by using wp-env)
  2. Follow the instructions to build block-experiments in its README
  3. Symlink or move it to the plugins folder of your WP instance
  4. Activate the plugin
  5. Profit

Categories

  • Keep a8c/bauhaus-centenary in widgets
  • Keep a8c/event in widgets
  • Change jetpack/layout-grid from layout -> design
  • Change jetpack/layout-grid-column from layout -> design
  • Keep a8c/motion-background-container in widgets
  • Keep a8c/starscape in widgets
  • Keep a8c/waves in widgets

Note: If this PR gets approved and merged, then I'll remove the helper function and tests from here (including the installation/configuration of jest).

Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

Thanks @fullofcaffeine!

I left some notes suggesting ways that we can apparently align more with this project's setup. I say "apparently" because I'm not familiar with this project myself 🙂

@fullofcaffeine fullofcaffeine force-pushed the update/blocks-categories branch 4 times, most recently from 2d96341 to 6cf4b5b Compare July 8, 2020 21:09
Copy link
Member

@WunderBart WunderBart left a comment

Choose a reason for hiding this comment

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

Tested with pre- & post-category-update Gutenberg versions - Layout Grid blocks appear under correct categories. Thanks!

Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

I left one suggestion. With this already approved by @WunderBart's, let's get this shipped! 🚀

@@ -0,0 +1 @@
export * from './helpers';
Copy link
Member

Choose a reason for hiding this comment

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

We could probably do with a bit less indirection here 🙂

Effectively, we have _helpers proxied to _helpers/helpers.js by way of _helpers/index.js. I appreciate re-exporting small, related modules from an index file, but this seems like YAGNI.

I'd propose these alternatives we put the contents of blocks/_helpers/helpers.js directly in blocks/_helpers.js and remove directory (YAGNI, this is simplest).

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, good points 👍

@johngodley
Copy link
Member

supporting old environments

I'm not sure of the context to this change, but what old environment is this referring to?

@sirreal
Copy link
Member

sirreal commented Jul 14, 2020

I'm not sure of the context to this change, but what old environment is this referring to?

@johngodley Gutenberg 8.3 removes some block categories and introduces some new ones. There is some built-in handling that maps legacy categories to new ones (blocks using older categories won't break), there is no protection in the other direction (blocks using new categories either without Gutenberg installed or with an out-of-date version will break).

The purpose of this change is to define the category for each block in both contexts, whether new categories or old categories are present.

The "old environment" refers to:

  • WordPress < 5.5 without Gutenberg installed.
  • Any site running Gutenberg < 8.3.

@johngodley
Copy link
Member

Thanks. If it makes things easier we can tie the release of this to minimum WP 5.5?

@sirreal
Copy link
Member

sirreal commented Jul 14, 2020

I'm not familiar with this project, but I don't think it's necessary to wait. There's a relatively straightforward helper function added.

I think this can move ahead without restricting the version to WP 5.5 unless you disagree.

@johngodley
Copy link
Member

The plugin gets bundled up for .org and for .com, and this change will require modifying that bundling process to also include the helper file (sadly it's in a different location).

This isn't a problem as such. However we don't really need a lot of backwards compatibility, and we generally set the minimum to the latest version of WP. We'll do this for some upcoming changes anyway.

Based on what you said about WP 5.5 we could simplify the change to a straight layout => design swap, drop the helpers, and bump the minimum. Once 5.5 is on .com and Atomic we can merge and use the new category.

Happy to go either way though.

@sirreal
Copy link
Member

sirreal commented Jul 14, 2020

What's the timeline like for a WP 5.5–only release? I'd be happy to drop the legacy category handling and just update to the new categories. Would you take over merging this when appropriate for that release?

@fullofcaffeine fullofcaffeine force-pushed the update/blocks-categories branch from 6cf4b5b to 0a6027a Compare July 14, 2020 21:40
@fullofcaffeine fullofcaffeine force-pushed the update/blocks-categories branch from 0a6027a to c905db4 Compare July 14, 2020 21:46
@johngodley
Copy link
Member

WP 5.5 seems scheduled for 11th August. In terms of the layout grid we'll be releasing a minor fix in the next day or two (1.2.4), and a more substantial release in the next week or two (1.3). Both of these should make it out before WP 5.5.

There's a big release coming up (1.4), which will be ready after 5.5 is released, and will definitely require 5.5 as a minimum.

In the meantime, assuming that the existing category continues to work with 5.5, then I can include this PR as part of the bigger 1.4 release.

If something does happen in the meantime then we can just include this PR anyway.

@sirreal
Copy link
Member

sirreal commented Jul 15, 2020

I'm happy to let you decide when the tradeoffs to land this sooner or later make the most sense for this project.

@fullofcaffeine
Copy link
Author

Should we abandon this PR?

@johngodley
Copy link
Member

Yeah, sorry, Layout Grid 1.3 hasn't been released yet so this was left untouched.

Based on the above conversation, and that 5.5 is now released, I don't think we need the back-compat helpers anymore and as such I'll close this PR.

I'll ensure that the category changes is applied to all the blocks in this repo, and they'll be included in the next releases. I'll also bump the minimum supported WP to 5.5.

@johngodley johngodley closed this Sep 2, 2020
@johngodley johngodley mentioned this pull request Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants